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

Example of DATA Step Program
Quality Control Application
This example illustrates how to use a stored compiled DATA step program for a simple
quality control application. This application processes several raw data files. The source
program uses the fileref Daily in the INFILE statement. Each DATA step that is used to
execute the stored program can include a FILENAME statement to associate the fileref
Daily with a different external file.
The following statements compile and store the program:
libname stored 'SAS-library-1';
data flaws / pgm=stored.flaws;
length Station $ 15;
infile daily;
input Station $ Shift $ Employee $ Flaws;
Total + Flaws;
run;
The following statements execute the stored compiled program, redirect the output, and
print the results:
libname stored 'SAS-library-1';
libname testlib 'SAS-library-2';
data pgm=stored.flaws;
redirect output flaws=testlib.daily;
run;
proc print data=testlib.daily;
title 'Quality Control Report';
run;
Output 28.1 Quality Control Application Output
Note that you can use the TITLE statement when you execute a stored compiled DATA
step program or when you print the results.
Example of DATA Step Program 687
688 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