SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Enhancing Reports
Assigning Descriptive Labels


To label the columns in your report with more descriptive text, you use the LABEL statement, which assigns a descriptive label to a variable.


General form, LABEL statement:
LABEL variable-1='label-1'
            . . . <variable-n='label-n'>;

Labels can be up to 256 characters long and must be enclosed in quotes.

CAUTION: To label columns in PROC PRINT output, you must also use the LABEL option in the PROC PRINT statement.


In the PROC PRINT step below, the variable WalkJogRun is displayed with the label Walk/Jog/Run. Note the LABEL option in the PROC PRINT statement.
proc print data=clinic.therapy label;
   label walkjogrun='Walk/Jog/Run';
run; 

This is partial output from the PROC PRINT step.


Obs Date AerClass Walk/Jog/Run Swim
1 JAN1999 56 78 14
2 FEB1999 32 109 19
3 MAR1999 35 106 22
4 APR1999 47 115 24
5 MAY1999 55 121 31
6 JUN1999 61 114 67
7 JUL1999 67 102 72
8 AUG1999 64 76 77
9 SEP1999 78 77 54
10 OCT1999 81 62 47


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;

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

Note: You can permanently assign a label to a variable in a SAS data set, or you can temporarily specify a label in a PROC step to label columns in output.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement