Previous Page | Next Page

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

 Note about code
libname proclib 'SAS-library';
 Note about code
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

 Note about figure
                       The Data Set TEMP                       1

     Manager       Sales  _____________BREAK______________
     3              1110                                  
     8              1045                                  

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

                   Managers with Daily Sales                   1
                            of over
                      One Thousand Dollars

                     ----------------------
                     |Manager        Sales|
                     |--------------------|
                     |Andrews|   $1,045.00|
                     |-------+------------|
                     |Reveiz |   $1,110.00|
                     ----------------------

Previous Page | Next Page | Top of Page