

Common Techniques Used In Reporting › 5.4 Using the OUTPUT Statement
5.4 Using the OUTPUT Statement
The way SAS DATA STEP processing works by default is that the
output data set (specified in the DATA statement) is
implicitly written when the end of the DATA STEP is reached.
Most often, this is the desired point at which the next
observation is to be added to the output data set.
However, the SAS OUTPUT statement is available if you want to
direct the output of the next observation at any point in the
DATA STEP. The OUTPUT statement tells SAS to write the
current observation to a SAS data set immediately.
Note: Once you use an OUTPUT statement to write an
observation to a data set, there is no longer an implicit
OUTPUT statement at the end of the DATA STEP.
Creating Many Files from One
----------------------------
The OUTPUT statement allows you to create many different
output files from one CA MICS input file. Here is an
example:
DATA JOBSHOR JOBLONG;
SET &PJOBD.BATJOB01;
IF JOBEXCTM LE 600 THEN OUTPUT JOBSHOR;
ELSE OUTPUT JOBLONG;
RUN;
The result of running this DATA STEP is that you will have
two new SAS files in the WORK z/OS data set:
o One that contains all observations for jobs that executed
for 10 minutes or less.
o One that contains all observations for jobs that executed
longer than 10 minutes.
Creating Multiple Output Records from Single Input Record
---------------------------------------------------------
The OUTPUT statement also allows you to create multiple
output records from a single input record. Here is an
example:
DATA JOBTIME;
SET &PJOBD.BATJOB01;
USEVALU = 1;
IF JOBHIPTM = 0 AND JOBEVIO = 0 THEN DO;
USEFLAG = 'NOTHING SPECIAL';
OUTPUT;
END;
ELSE DO;
IF JOBHIPTM GT 0 THEN DO;
USEFLAG = 'HIPERSPACE ';
OUTPUT;
END;
IF JOBEVIO GT 0 THEN DO;
USEFLAG = 'VIO ';
OUTPUT;
END;
END;
RUN;
PROC CHART;
PIE USEFLAG / SUMVAR = USEVALU;
RUN;
The result of running this two-step program is a new SAS file
in the WORK z/OS data set that contains up to twice as many
observations as the input file. The PROC CHART step will
then produce a pie chart with three slices:
o One representing the number of jobs not using hiperspace or
VIO.
o One representing the number of jobs using hiperspace.
o One representing the number of jobs using VIO.
Copyright © 2014 CA.
All rights reserved.
 
|
|