Previous Page | Next Page

The PRINT Procedure

Example 1: Selecting Variables to Print


Procedure features:

PROC PRINT statement options:

BLANKLINE

DOUBLE

STYLE

VAR statement

Other Features:

DATA step

FOOTNOTE statement

ODS HTML statement

OPTIONS statement

TITLE statement

Data set: EXPREV


Program Description

This example


Program: Creating a Listing Report

 Note about code
options nodate pageno=1 linesize=80 pagesize=30 obs=10;
 Note about code
proc print data=exprev double;
 Note about code
   var country price sale_type;
 Note about code
   title 'Monthly Price Per Unit and Sale Type for Each Country';
   footnote '*prices in USD'; 
run;

Output: Listing

Selecting Variables: Listing Output

 Note about figure
             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

Program: Creating an HTML Report

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
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
ods html close;

Output: HTML

Selecting Variables: Default HTML Output

[Selecting Variables: Default HTML Output]


Program: Creating an HTML Report with the STYLE and BLANKLINE Options

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
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
ods html close;

Output: HTML Output with Styles

Selecting Variables: HTML Output Using Styles

[Selecting Variables: HTML Output Using Styles]

Previous Page | Next Page | Top of Page