Chapter Contents

Previous

Next
The REPORT Procedure

Example 7: Storing and Reusing a Report Definition


Procedure features:
PROC REPORT statement options:
NAMED
OUTREPT=
REPORT=
WRAP
Other features:
TITLE statement
WHERE statement
Data set: GROCERY
Formats: $SCTRFMT., $MGRFMT. and $DEPTFMT.

The first PROC REPORT step in this example creates a report that displays one value from each column of the report, using two rows to do so, before displaying another value from the first column. (By default, PROC REPORT displays values for only as many columns as it can fit on one page. It fills a page with values for these columns before starting to display values for the remaining columns on the next page.)

Each item in the report is identified in the body of the report rather than in a column header.

The report definition created by the first PROC REPORT step is stored in a catalog entry. The second PROC REPORT step uses it to create a similar report for a different sector of the city.


Program to Store a Report Definition

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=60
        fmtsearch=(proclib);
 Note about code
proc report data=grocery nowd
            named
            wrap
            ls=64 ps=36
            outrept=proclib.reports.namewrap;


 Note about code
   column sector manager department sales;
 Note about code
   define sector / format=$sctrfmt.;
   define manager / format=$mgrfmt.;
   define department / format=$deptfmt.;
   define sales / format=dollar11.2;
 Note about code
   where manager='1';
   title "Sales Figures for Smith on &sysdate";
run;


Output
This is the output from the first PROC REPORT step, which creates the report definition. [HTML Output]
 [Listing Output]


Program to Use a Report Definition
 Note about code
options nodate pageno=1 fmtsearch=(proclib); 
proc report data=grocery report=proclib.reports.namewrap
            nowd;
   where sector='sw';
   title "Sales Figures for the Southwest Sector on &sysdate";
run;


Output
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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