output from this execution of the program is redirected and stored in a data set named
Totals.Sample. Log 28.3 on page 662 shows part of the SAS log.
libname in 'SAS-library';
libname base 'SAS-library';
libname totals 'SAS-library';
libname stored 'SAS-library';
data pgm=stored.sample;
redirect input in.sample=base.sample;
redirect output out.sample=totals.sample;
Log 28.3 Partial SAS Log Identifying the Redirected Output File
224 data pgm=stored.sample;
225 redirect input in.sample=base.sample;
226 redirect output out.sample=totals.sample;
227 run;
NOTE: DATA STEP program loaded from file Stored.Sample.
NOTE: There were 7 observations read from the data set BASE.SAMPLE.
NOTE: The data set Totals.Sample has 7 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.12 seconds
cpu time 0.01 seconds
228 proc printto; run;
Differences between Stored Compiled DATA Step
Programs and DATA Step Views
Stored compiled DATA step programs and DATA step views are similar in function.
They both store DATA step programs that can retrieve and process data stored in other
files. Both have the same restrictions and requirements (see “Restrictions and
Requirements for Stored Compiled DATA Step Programs” on page 656). For
information about DATA step views, see “DATA Step Views” on page 647.
Stored compiled DATA step programs and DATA step views differ in the following
A stored compiled DATA step program is explicitly executed when it is specified by
the PGM= option in a DATA statement. The stored compiled DATA step is used
primarily in production jobs.
A DATA step view is implicitly executed when the view is referenced as an input
data set by another DATA or procedure (PROC) step. Its main purpose is to provide
data one record at a time to the invoking procedure or DATA step.
You can use the REDIRECT statement when you execute a stored compiled DATA
step. You cannot use this statement with DATA step views.
662 Chapter 28 Stored Compiled DATA Step Programs

Get SAS 9.4 Language Reference, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.