Shared Concepts and Topics


CODE Statement

Subsections:

This statement documentation applies to the following procedures:GENMOD, GLIMMIX, GLM, GLMSELECT, LOGISTIC, MIXED, PLM, and REG. It also applies to the HPLOGISTIC and HPREG procedures in SAS High-Performance Analytics software.

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 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;