When
you use a LABEL or FORMAT statement within a PROC step, the label
or format applies only to the output from that step.
However, in PROC steps,
you can also use permanently assigned labels or formats. Permanent
labels and formats can be assigned in the DATA step. These labels
and formats are saved with the data set, and they can be reused by
procedures that reference the data set.
For example, the DATA
step below creates Flights.March and defines a format and label for
the variable Date. Because the LABEL and FORMAT statements are inside
the DATA step, they are written to the Flights.March data set and
are available to the subsequent PRINT procedure.
data sasuser.paris;
set sasuser.laguardia;
where dest="PAR" and (boarded=155 or boarded=146);
label date=’Departure Date’;
format date date9.;
run;
proc print data=sasuser.paris label date='Departure Date';
var date dest boarded;
run;
Notice that the PROC
PRINT statement still requires the LABEL option in order to display
the permanent labels. Other SAS procedures display permanently assigned
labels and formats without additional statements or options.