Procedure features: |
PROC
PRINT statement options:
|
BY
statement |
PAGEBY statement |
|
Other features: |
SORT procedure |
FORMAT statement |
LABEL statement |
ODS RTF statement |
TITLE
statement |
|
Data set: |
EXPREV
|
This example
-
suppresses the
printing of observation numbers at the beginning
of each row
-
presents the data for each sale type in a separate section of
the report
-
creates a default RTF report
-
creates a stylized RTF report.
|
options nodate pageno=1 linesize=80 pagesize=40 obs=10; |
|
proc sort data=exprev;
by sale_type order_date quantity;
run; |
|
proc print data=exprev n='Number of observations for the month: '
noobs label; |
|
var quantity cost price; |
|
by sale_type order_date;
pageby order_date; |
|
label sale_type='Order Type' order_date='Order Date'; |
|
format price dollar7.2 cost dollar7.2;
title 'Prices and Cost Grouped by Date and Order Type';
title2 'in USD';
run; |
Creating Separate Sections of a Report for Groups of Observations: Listing Output
Prices and Cost Grouped by Date and Order Type 1
in USD
--------------------- Order Type=Catalog Order Date=1/1/08 ---------------------
Quantity Cost Price
7 $9.25 $41.00
8 $28.45 $113.40
14 $12.10 $51.20
30 $59.00 $123.70
Number of observations for the month: 4
Prices and Cost Grouped by Date and Order Type 2
in USD
--------------------- Order Type=Catalog Order Date=1/2/08 ---------------------
Quantity Cost Price
11 $20.20 $40.20
100 $5.00 $11.80
Number of observations for the month: 2
Prices and Cost Grouped by Date and Order Type 3
in USD
-------------------- Order Type=In Store Order Date=1/1/08 ---------------------
Quantity Cost Price
25 $15.65 $31.10
Number of observations for the month: 1
Prices and Cost Grouped by Date and Order Type 4
in USD
-------------------- Order Type=In Store Order Date=1/2/08 ---------------------
Quantity Cost Price
2 $36.70 $146.40
20 $32.30 $71.00
Number of observations for the month: 2
Prices and Cost Grouped by Date and Order Type 5
in USD
-------------------- Order Type=Internet Order Date=1/1/08 ---------------------
Quantity Cost Price
2 $20.70 $92.60
Number of observations for the month: 1
options nodate pageno=1 linesize=80 pagesize=40 obs=10;
|
ods rtf file='your_file.rtf' startpage=no; |
proc sort data=exprev;
by sale_type order_date quantity;
run;
proc print data=exprev n='Number of observations for each order type:'
noobs label;
var quantity cost price;
by sale_type order_date;
pageby order_date;
label sale_type='Order Type' order_date='Order Date';
format price dollar7.2 cost dollar7.2;
title 'Price and Cost Grouped by Date and Order Type';
title2 'in USD';
run;
|
ods rtf close; |
Creating Separate Sections of a Report for Groups of Observations: Default RTF Output
options nodate pageno=1 linesize=80 pagesize=40 obs=10;
ods rtf file='your_file.rtf' startpage=no;
proc sort data=exprev;
by sale_type order_date quantity;
run;
|
proc print data=exprev n='Number of observations for the month: '
noobs label style(N) = {background = gray};
var quantity / style(header) = [background = white];
var cost / style(header) = [background = blue foreground = white];
var price / style(header) = [background = gray];
by sale_type order_date;
pageby order_date;
label sale_type='Order Type' order_date='Order Date';
format price dollar7.2 cost dollar7.2;
title 'Prices and Cost Grouped by Date and Order Type';
title2 '*prices in USD';
run; |
ods rtf close;
Creating Separate Sections of a Report for Groups of Observations: RTF Output Using Styles
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.