Shared Concepts and Topics

CODE Statement

This section applies to the following procedures: GENMOD, GLIMMIX, GLM, GLMSELECT, HPGENSELECT, HPLOGISTIC, HPQUANTREG, HPREG, LOGISTIC, MIXED, PHREG, PLM, QUANTSELECT, and REG.

The CODE statement enables you to write SAS DATA step code to a file or catalog entry for computing predicted values of the fitted model. This code can then be included in a DATA step to score new data. For example, in the following program, the CODE statement writes the code for predicting the outcome of a logistic regression model to the file mycode.sas. The file is subsequently included in a DATA step to score the sashelp.Bmt data.

proc logistic data=sashelp.Bmt;
   class Group;
   model Status=Group;
   code file='mycode.sas';
run;
data Score;
   set sashelp.Bmt;
   %include mycode;
run;
Last updated: December 09, 2022