The PCA Procedure

CODE Statement

  • CODE <options>;

The CODE statement writes SAS DATA step code for computing the principal component scores either to a file, to a catalog entry, or to a CAS table. This code can then be included in a DATA step to score new data.

The CODE statement is not supported when you specify the PARTIAL statement. If you specify more than one CODE statement, only the first one specified is used.

Table 5 summarizes the options available in the CODE statement.

Table 5: CODE Statement Options

Option Description
COMMENT Adds comments to the generated code
FILE= Names the file in which to save the generated code
FORMATWIDTH= Specifies the numeric format width for the regression coefficients
INDENTSIZE= Specifies the number of spaces to indent the generated code
LABELID= Specifies a number used to construct names and labels
LINESIZE= Specifies the line size for the generated code
NOTRIM Compares formatted values, including blank padding
OUT= Names an output CAS table in which to save the generated code


For more information about the syntax of the CODE statement, see the section CODE Statement in Chapter 2, Shared Concepts.

Last updated: September 17, 2021