Shared Concepts and Topics

CODE Statement

  • CODE <options>;

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 hplogistic data=sashelp.Bmt;
   class Group;
   model Status=Group;
   code file='mycode.sas';
run;
data Score;
   set sashelp.Bmt;
   %include mycode;
run;

This statement is supported by several procedures. The options you can specify in the CODE statement are described in each procedure that supports this statement.

Last updated: March 06, 2023