The following
example uses the information in the input SAS data set IN.SAMPLE to
assign a plant type based on a plant code. Note that the global LIBNAME
statements are necessary to identify the storage location for your
files, but are not part of STORED.SAMPLE, the DATA step that SAS stores.
libname in 'SAS-library';
libname stored 'SAS-library';
data out.sample / pgm=stored.sample;
set in.sample;
if code = 1 then
do;
Type='Perennial';
number+4;
end;
else
if code = 2 then
do;
Type='Annual';
number+10;
end;
else
do;
Type='ERROR';
Number=0;
end;
run;
Partial SAS Log Identifying the Stored DATA Step Program
.
.
.
NOTE: DATA STEP program saved on file STORED.SAMPLE.
NOTE: A stored DATA STEP program cannot run under a different operating
system.
NOTE: DATA statement used (Total process time):
real time 0.17 seconds
cpu time 0.01 seconds