The DATASOURCE Procedure

ATTRIBUTE Statement

  • ATTRIBUTE variable-list attribute-list …;

The ATTRIBUTE statement assigns formats, labels, and lengths to variables in the output data sets.

The variable-list can contain variable names and variable name range specifications. See Variable Lists for details. The attributes specified in the following attribute list apply to all variables in the variable list.

An attribute-list consists of one or more of the following options:

FORMAT= format

associates a format with variables in variable-list. The format can be either a standard SAS format or a format defined with the FORMAT procedure. The default formats for variables depend on the file type.

LABEL= "label"

assigns a label to the variables in the variable list. The default labels for variables depend on the file type. Labels can be up to 256 bytes in length.

LENGTH= length

specifies the number of bytes used to store the values of variables in the variable list. The default lengths for numeric variables depend on the file type. Usually default lengths are set to 5 bytes.

The length specification also controls the amount of memory that PROC DATASOURCE uses to hold variable values while processing the input data file. Thus, specifying a LENGTH= value smaller than the default will reduce both the disk space taken up by the output data sets and the amount of memory used by the PROC DATASOURCE step, at the cost of precision of output data values.