Use of the DATA step and PROC PRINT is the most common way to produce reports. For example, from the data set solution shown in Figure 3.6, a table that shows the revenue of the optimal production plan and a table of the cost of material can be produced with the following program:
data product(keep= _var_ _value_ _price_ revenue)
material(keep=_var_ _value_ _price_ cost);
set solution;
if _price_>0 then do;
revenue=_price_*_value_; output product;
end;
else if _price_<0 then do;
_price_=-_price_;
cost = _price_*_value_; output material;
end;
run;
/* display the product report */
proc print data=product;
id _var_;
var _value_ _price_ revenue ;
sum revenue;
title 'Revenue Generated from Tie Sales';
run;
/* display the materials report */
proc print data=material;
id _var_;
var _value_ _price_ cost;
sum cost;
title 'Cost of Raw Materials';
run;
This DATA step reads the solution data set saved by PROC LP and segregates the records based on whether they correspond to materials or products—namely whether the contribution to profit is positive or negative. Each of these is then displayed to produce Figure 3.9.
Figure 3.9
Tie Problem: Revenues and Costs
11.8 |
3.55 |
41.890 |
7.0 |
6.70 |
46.900 |
8.5 |
4.81 |
40.885 |
15.3 |
4.31 |
65.943 |
13.6 |
0.90 |
12.24 |
22.0 |
0.60 |
13.20 |
7.0 |
0.21 |
1.47 |
Copyright © SAS Institute Inc. All rights reserved.