The NLMIXED Procedure

RANDOM Statement

RANDOM random-effects ~distribution SUBJECT=variable <options> ;

The RANDOM statement defines the random effects and their distribution. The random effects must be represented by symbols that appear in your SAS programming statements. The random effects usually influence the mean value of the distribution that is specified in the MODEL statement. The RANDOM statement consists of a list of the random effects (usually just one or two symbols), a tilde (~), the distribution of the random effects, and then a SUBJECT= variable.

The only distribution available for the random effects is normal(m,v), with mean m and variance v.

This syntax is illustrated as follows for one effect:

random u ~ normal(0,s2u) subject=clinic;

For multiple effects, you should specify bracketed vectors for m and v, the latter consisting of the lower triangle of the random-effects variance matrix listed in row order. This is illustrated for two random effects as follows:

random b1 b2 ~ normal([0,0],[g11,g21,g22]) subject=person;

Similarly, the syntax for three random effects is illustrated as follows:

random b1 b2 b3 ~ normal([0,0,0],[g11,g21,g22,g31,g32,g33])

The SUBJECT= variable determines the unique realizations of the random effects.

PROC NLMIXED constructs the subject clusters based on unique values in the SUBJECT= variable. This construction process of clusters, starting in SAS/STAT 13.1, is different from that in earlier releases of PROC NLMIXED, where a change in the SUBJECT= variable value indicates a new cluster. Because of this change, starting in SAS/STAT 13.1, the input data set does not need to be sorted by SUBJECT= variable to use the unique SUBJECT= variable values.

On the other hand, in earlier releases of SAS/STAT, PROC NLMIXED does not sort the input data set for you; rather, it processes the data sequentially and considers an observation to be from a new subject whenever the value of its SUBJECT= variable changes from the previous observation. To revert to this sequential process behavior of SAS/STAT 12.3 and previous releases, specify the NOSORTSUB option in the PROC NLMIXED statement.

Only one RANDOM statement is permitted, so multilevel nonlinear mixed models are not accommodated. However, you can specify certain nested random effects structure with a single RANDOM statement (see Chapter 15 of Littell et al. (2006) for an example).

You can specify the following options in the RANDOM statement:

ALPHA=$\alpha $

specifies the alpha level to be used in computing t statistics and intervals. The default value corresponds to the ALPHA= option in the PROC NLMIXED statement.


specifies the degrees of freedom to be used in computing t statistics and intervals in the OUT= data set. The default value corresponds to the DF= option in the PROC NLMIXED statement.


requests an output data set containing empirical Bayes estimates of the random effects and their approximate standard errors of prediction.