Chapter Contents

Previous

Next
The REPORT Procedure

Example 13: Storing Computed Variables as Part of a Data Set


Procedure features:
PROC REPORT statement options:
OUT=
COMPUTE statement:
with a computed variable as report-item
DEFINE statement options:
COMPUTED
Other features: CHART procedure
Data set: GROCERY
Formats: $SCTRFMT.

The report in this example






Program that Creates the Output Data Set

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib);
 Note about code
title;
proc report data=grocery nowd out=profit;
 Note about code
   column sector manager department sales Profit;
 Note about code
   define profit / computed;
 Note about code
      /* Compute values for Profit. */
   compute profit;
      if department='np1' or department='np2' then profit=0.4*sales.sum;
      else profit=0.25*sales.sum;
   endcomp;
run;


The Output Data Set
This is the output data set created by PROC REPORT. It is used as input for PROC CHART. [HTML Output]
 [Listing Output]


Program That Uses the Output Data Set
 Note about code
title;
options nodate pageno=1 linesize=80 pagesize=60
        fmtsearch=(proclib);
proc chart data=profit;
   block sector / sumvar=profit;
   format sector $sctrfmt.;
   format profit dollar7.2;
run;


Output from Processing 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.