O'Reilly logo

SAS 9.4 Language Reference, 6th Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

output from this execution of the program is redirected and stored in a data set named
Totals.Sample. Log 28.3 on page 686 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;
run;
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 680). For
information about DATA step views, see “DATA Step Views” on page 671.
Stored compiled DATA step programs and DATA step views differ in the following
ways:
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.
686 Chapter 28 Stored Compiled DATA Step Programs

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required