This section lists the programming statements available in PROC MCMC to compute the priors and log-likelihood functions. This section also documents the differences between programming statements in PROC MCMC and programming statements in the DATA step. The syntax of programming statements used in PROC MCMC is identical to that used in the NLMIXED procedure (see Chapter 63, The NLMIXED Procedure ) and the MODEL procedure (see Chapter 19, The MODEL Procedure (SAS/ETS User's Guide),). Most of the programming statements that can be used in the DATA step can also be used in PROC MCMC. Refer to SAS Language Reference: Dictionary for a description of SAS programming statements.
There are also a number of unique functions in PROC MCMC that calculate the log density of various distributions in the procedure. You can find them at the section Using Density Functions in the Programming Statements.
For the list of matrix-based functions that is supported in PROC MCMC, see the section Matrix Functions in PROC MCMC.
The following are valid statements:
CALL name [ ( expression [, expression ...] ) ];
DO [ variable = expression
[TO expression] [BY expression]
[, expression [ TO expression] [ BY expression ] ...]
[ WHILE expression ] [ UNTIL expression ];
IF expression THEN program_statement;
variable = expression;
variable + expression;
PUT [ variable] [=] [...];
SUBSTR( variable, index, length )= expression;
WHEN (expression) program_statement;
For the most part, the SAS programming statements work the same as they do in the DATA step, as documented in SAS Language Reference: Concepts. However, there are several differences:
The ABORT statement does not allow any arguments.
The DO statement does not allow a character index variable. Thus
do i = 1,2,3;
is supported; however, the following statement is not supported:
do i = 'A','B','C';
The PUT statement, used mostly for program debugging in PROC MCMC (see the section Handling Error Messages), supports only some of the features of the DATA step PUT statement, and it has some features that are not available with the DATA step PUT statement:
The PROC MCMC PUT statement does not support line pointers, factored lists, iteration factors, overprinting, _INFILE_, _OBS_, the colon (:) format modifier, or "$".
The PROC MCMC PUT statement does support expressions, but the expression must be enclosed in parentheses. For example, the following statement displays the square root of x:
The WHEN and OTHERWISE statements enable you to specify more than one target statement. That is, DO/END groups are not necessary for multiple statement WHENs. For example, the following syntax is valid:
select; when (exp1) stmt1; stmt2; when (exp2) stmt3; stmt4; end;
You should avoid defining variables that begin with an underscore (_). They might conflict with internal variables created by PROC MCMC. The MODEL statement must come after any SAS programming statements that define or modify terms used in the construction of the log likelihood.