Procedure features: |
PROC
PRINT statement options:
|
VAR statement |
|
Other Features: |
DATA step |
FOOTNOTE statement |
ODS HTML statement |
OPTIONS statement |
TITLE
statement |
|
Data set: |
EXPREV
|
This example
-
selects three variables for the reports
-
uses variable labels as
column headings
-
double spaces between rows of the report
-
creates a default HTML report
-
creates a stylized HTML
report.
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
options nodate pageno=1 linesize=80 pagesize=30 obs=10; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc print data=exprev double; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
var country price sale_type; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
title 'Monthly Price Per Unit and Sale Type for Each Country';
footnote '*prices in USD';
run; |
Selecting Variables: Listing Output
![Note about figure](../../../../common/63294/HTML/default/images/snbut.gif) |
Monthly Price Per Unit and Sale Type for Each Country 1
Sale_
Obs Country Price Type
1 Antarctica 92.6 Internet
2 Puerto Rico 51.2 Catalog
3 Virgin Islands (U.S.) 31.1 In Store
4 Aruba 123.7 Catalog
5 Bahamas 113.4 Catalog
6 Bermuda 41.0 Catalog
7 Belize 146.4 In Store
8 British Virgin Islands 40.2 Catalog
9 Canada 11.8 Catalog
10 Cayman Islands 71.0 In Store
*prices in USD
| |
Selecting Variables: Listing Output
Monthly Price Per Unit and Sale Type for Each Country 1
Sale_
Obs Country Price Type
1 Antarctica 92.6 Internet
2 Puerto Rico 51.2 Catalog
3 Virgin Islands (U.S.) 31.1 In Store
4 Aruba 123.7 Catalog
5 Bahamas 113.4 Catalog
6 Bermuda 41.0 Catalog
7 Belize 146.4 In Store
8 British Virgin Islands 40.2 Catalog
9 Canada 11.8 Catalog
10 Cayman Islands 71.0 In Store
*prices in USD
You can easily create
HTML output by adding ODS statements. In the following example, ODS statements
are added to produce HTML output.
options nodate pageno=1 linesize=80 pagesize=30 obs=10;
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
ods html file='your_file.html'; |
proc print data=exprev double;
var country price sale_type;
title 'Monthly Price Per Unit and Sale Type for Each Country';
footnote '*prices in USD';
run;
run;
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
ods html close; |
Selecting Variables: Default HTML Output
![[Selecting Variables: Default HTML Output]](images/procprintselectvar.gif)
You can go a step further and add more formatting to your HTML output.
The following example uses the STYLE option to add shading and spacing to
your HTML report.
options nodate pageno=1 linesize=80 pagesize=40 obs=5;
ods html file='your_file_styles.html';
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc print data=exprev double
style(header) = {fontstyle=italic color= white}
style(obs) = {backgroundcolor=red}
blankline=(count=1 style={backgroundcolor=red}); |
var country price sale_type;
title 'Monthly Price Per Unit and Sale Type for Each Country';
footnote '*prices in USD';
run;
run;
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
ods html close; |
Selecting Variables: HTML Output Using Styles
![[Selecting Variables: HTML Output Using Styles]](images/procprintselectvarstyles.gif)
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.