Assigning Descriptive Labels

Temporarily Assigning Labels to Variables

You can also enhance your PROC PRINT report by labeling columns with more descriptive text. To label columns:
  • Use the LABEL statement to assign a descriptive label to a variable.
  • Use the LABEL option in the PROC PRINT statement to specify that the labels be displayed.
Syntax, LABEL statement:
LABEL variable1='label1'
variable2='label2'
... ;
Labels can be up to 256 characters long. Enclose the label in quotation marks.
Tip:The LABEL statement applies only to the PROC step in which it appears.

Example: The LABEL Option

In the PROC PRINT step below, the variable name WalkJogRun is displayed with the label Walk/Jog/Run. Note the LABEL option in the PROC PRINT statement. Without the LABEL option in the PROC PRINT statement, PROC PRINT would use the name of the column heading, walkjogrun, even though you specified a value for the variable.
proc print data=clinic.therapy label; 
   label walkjogrun='Walk/Jog/Run'; 
run;
Figure 5.24 Output Created with the LABEL Option (partial output)
Output Created With the LABEL Option (partial output)

Using Single or Multiple LABEL Statements

You can assign labels in separate LABEL statements.
proc print data=clinic.admit label; 
   var age height; 
   label age='Age of Patient'; 
   label height='Height in Inches'; 
run;
Output 5.4 HTML Output with Multiple LABEL Statements (partial output)
HTML Output with Multiple LABEL Statements (partial output)
Alternatively, you can assign any number of labels in a single LABEL statement.
proc print data=clinic.admit label; 
   var actlevel height weight; 
   label actlevel='Activity Level' 
          height='Height in Inches' 
          weight='Weight in Pounds'; 
run;
Output 5.5 HTML Output with One LABEL Statement (partial output)
HTML Output with SingleLABEL Statement (partial output)
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.152.58