Chapter Contents

Previous

Next
The REPORT Procedure

Example 12: Creating and Processing an Output Data Set


Procedure features:
PROC REPORT statement options:
BOX
OUT=
DEFINE statement options:
ANALYSIS
GROUP
NOPRINT
SUM
Other features:
Data set options:
WHERE=
Data set: GROCERY
Formats: $MGRFMT.

This example uses WHERE processing as it builds an output data set. This technique enables you to do WHERE processing after you have consolidated multiple observations into a single row.

The first PROC REPORT step creates a report (which it does not display) in which each row represents all the observations from the input data set for a single manager. The second PROC REPORT step builds a report from the output data set. This report uses line-drawing characters to separate the rows and columns.


Program to Create Output Data Set

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib);



 Note about code
proc report data=grocery nowd
            out=temp( where=(sales gt 1000) );
   column manager sales;
 Note about code
   define manager / group noprint;
   define sales / analysis sum noprint;
run;


Output Showing the Output Data Set
This is the output data set that PROC REPORT creates. It is used as the input DATA step in the next PROC REPORT step. [HTML Output]
 [Listing Output]


Program That Uses the Output Data Set
 Note about code
proc report data=temp box nowd;
   column manager sales;
   define manager / group format=$mgrfmt.;
   define sales / analysis sum format=dollar11.2;
   title 'Managers with Daily Sales';
   title2 'of over';
   title3 'One Thousand Dollars';
run;


Report Based on the Output Data Set
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.