8.4 Statements, branches, loops and special variables
The abbreviated-code interpreter supports assignments, block and single-line conditions, loops and controlled exits:
X = expressionand indexed targets such asA_0(1)orDADT(2);IF ... THEN,ELSE IF,ELSE,ENDIF;- single-line
IF (condition) statement; DO WHILE ... ENDDO;RETURN;EXIT n k.
An unterminated DO WHILE is stopped after 1,000,000 iterations and becomes a numerical failure. EXIT also becomes a numerical failure annotated with block and data row.
Arrays and targets
Readable arrays include THETA, ETA, EPS/ERR, A, A_0/A0, DADT, MTIME, MPAST, MNEXT and COM. Assignment is more restricted than reading: A_0(n) may be set in $PK, DADT(n) in $DES, and model times through the appropriate target. COM(n) assignments can be accepted without influencing the likelihood.
Special variables
| Variable | Implemented meaning |
|---|---|
T |
Integration time inside $DES |
NEWIND |
1 on the first record, 2 thereafter |
ICALL |
2 by default for estimation; simulation can supply 4 |
NIREC, NDREC |
Subject record context |
IREP |
Currently evaluates to 0 |
MIXNUM, MIXEST |
Currently evaluate to 1 |
The simplified values for IREP and mixture variables are compatibility boundaries, not full NONMEM mixture support.
Ignored statements
Some statements that do not alter the likelihood—such as accepted CALL or COMRES/CALLFL forms—are compiled as no-ops. “Accepted” must not be documented as “executed.” If scientific behavior depends on an ignored call, the model is not reproduced.
Common mistakes
- Assuming every syntactically accepted statement has operational effect.
- Using mixture variables as though a mixture model were implemented.
- Allowing a loop bound to depend on unstable floating-point equality.
Checklist
- Classify every statement as executed, restricted or ignored.
- Verify special-variable values for the intended workflow.
- Add tests for every branch and loop exit.
Further reading
See unsupported constructs, subject timelines and simulation semantics.