Previous Page | Next Page

The PRINT Procedure

Example 6: Limiting the Number of Sums in a Report


Features:

BY statement

SUM statement

SUMBY statement

Other features:

FORMAT statement

LABEL statement

ODS PDF statement

SORT procedure

TITLE statement

Data set: EXPREV

This example


Program: Creating a Listing Report

 Note about code
options nodate pageno=1 linesize=80 pagesize=40 obs=10;
 Note about code
proc sort data=exprev;
   by sale_type order_date;
run;
 Note about code
proc print data=exprev noobs sumlabel;
 Note about code
   by sale_type order_date;
   sum price quantity;
   sumby sale_type;
 Note about code
   label sale_type='Sale Type' order_date='Sale Date';
 Note about code
   format price dollar10.2 cost dollar10.2;
   title 'Retail and Quantity Totals for Each Sale Type';
run;

Output: Listing

Limiting the Number of Sums in a Report: Listing Output

 Note about figure
                 Retail and Quantity Totals for Each Sale Type                 1

---------------------- Sale Type=Catalog Sale Date=1/1/08 ----------------------

                              Ship_
   Country         Emp_ID      Date     Quantity         Price          Cost

   Puerto Rico    99999999    1/5/08       14           $51.20        $12.10
   Aruba          99999999    1/4/08       30          $123.70        $59.00
   Bahamas        99999999    1/4/08        8          $113.40        $28.45
   Bermuda        99999999    1/4/08        7           $41.00         $9.25


---------------------- Sale Type=Catalog Sale Date=1/2/08 ----------------------

                                    Ship_
Country                   Emp_ID     Date    Quantity        Price         Cost

British Virgin Islands   99999999   1/5/08       11         $40.20       $20.20
Canada                   99999999   1/5/08      100         $11.80        $5.00
----------------------                       --------   ----------
Sale Type                                       170        $381.30             


--------------------- Sale Type=In Store Sale Date=1/1/08 ----------------------

                                    Ship_
        Country           Emp_ID     Date    Quantity        Price         Cost

 Virgin Islands (U.S.)   99999999   1/4/08      25          $31.10       $15.65


--------------------- Sale Type=In Store Sale Date=1/2/08 ----------------------

                               Ship_
   Country           Emp_ID     Date     Quantity         Price          Cost

   Belize            120458    1/2/08        2          $146.40        $36.70
   Cayman Islands    120454    1/2/08       20           $71.00        $32.30
                 Retail and Quantity Totals for Each Sale Type                 2

--------------------- Sale Type=In Store Sale Date=1/2/08 ----------------------
                                  (continued)

                             Ship_
       Country     Emp_ID    Date     Quantity         Price          Cost

      ---------                       --------    ----------
      Sale Type                          47          $248.50              


--------------------- Sale Type=Internet Sale Date=1/1/08 ----------------------

                              Ship_
     Country       Emp_ID      Date     Quantity         Price          Cost

    Antarctica    99999999    1/7/08         2          $92.60        $20.70
                                        ========    ==========
                                           219         $722.40              

Program: Creating a PDF file

options nodate pageno=1 linesize=80 pagesize=40 obs=10;

 Note about code
ods pdf file='your_file.pdf';
proc sort data=exprev;
   by sale_type order_date;
run;

proc print data=exprev noobs sumlabel;

by sale_type order_date;
   sum price quantity;
   sumby sale_type;

   label sale_type='Sale Type' order_date='Sale Date';

   format price dollar10.2 cost dollar10.2;
   title 'Retail and Quantity Totals for Each Sale Type';
run;

 Note about code
ods pdf close;

Output: PDF

Limiting the Number of Sums in a Report: PDF Output

[Limiting the Number of Sums in a Report: PDF Output]


Program: Creating a PDF Report with the STYLE Option

options nodate pageno=1 linesize=80 pagesize=40 obs=10;

ods pdf file='your_file.pdf';

proc sort data=exprev;
   by sale_type order_date;
run;

proc print data=exprev noobs;

   by sale_type order_date;
   

 Note about code
   sum price / style(TOTAL) = [background =blue color=white];
   sum quantity / style(GRANDTOTAL) = [background =yellow color=red];
   sumby sale_type;
   label sale_type='Sale Type' order_date='Sale Date';

   format price dollar10.2 cost dollar10.2;
   title 'Retail and Quantity Totals for Each Sale Type';
run;

ods pdf close;


Output: PDF with Styles

Limiting the Number of Sums in a Report: PostScript Output Using Styles

[Limiting the Number of Sums in a Report: PostScript Output Using Styles]

Previous Page | Next Page | Top of Page