Previous Page | Next Page

The PRINT Procedure

Example 8: Creating a Customized Layout with BY Groups and ID Variables


Procedure features:

BY statement

ID statement

SUM statement

VAR statement

Other features:

SORT procedure

Data set: EMPDATA

This customized report


Program: Creating a Listing Report

 Note about code
options nodate pageno=1 linesize=64 pagesize=60;
proc sort data=empdata out=tempemp;
   by jobcode gender;
run;
 Note about code
proc print data=tempemp split='*';
 Note about code
   id jobcode;
   by jobcode;
   var gender salary;
 Note about code
   sum salary;
 Note about code
   label jobcode='Job Code*========'
         gender='Gender*======'
         salary='Annual Salary*=============';
 Note about code
   format salary dollar11.2;
   where jobcode contains 'FA' or jobcode contains 'ME';
   title 'Salay Expenses';
run;

Output: Listing

Creating a Customized Layout with BY Groups and ID Variables: Listing Output

 Note about figure
                         Salay Expenses                        1

              Job Code    Gender    Annual Salary
              ========    ======    =============

                FA1         F         $23,177.00 
                            F         $22,454.00 
                            M         $22,268.00 
              --------              -------------
                FA1                   $67,899.00 

                FA2         F         $28,888.00 
                            F         $27,787.00 
                            M         $28,572.00 
              --------              -------------
                FA2                   $85,247.00 

                FA3         F         $32,886.00 
                            F         $33,419.00 
                            M         $32,217.00 
              --------              -------------
                FA3                   $98,522.00 

                ME1         M         $29,769.00 
                            M         $28,072.00 
                            M         $28,619.00 
              --------              -------------
                ME1                   $86,460.00 

                ME2         F         $35,108.00 
                            F         $34,929.00 
                            M         $35,345.00 
                            M         $36,925.00 
                            M         $35,090.00 
                            M         $35,185.00 
              --------              -------------
                ME2                  $212,582.00 

                ME3         M         $43,025.00 
                                    =============
                                     $593,735.00 

Program: Creating an HTML Report

options nodate pageno=1 linesize=64 pagesize=60 obs=15;
proc sort data=empdata out=tempemp;
   by jobcode gender;
run;

 Note about code
ods html file='your_file.html';
proc print data=tempemp (obs=10) split='*';

 id jobcode;
   by jobcode;
   var gender salary;

   sum salary;

   label jobcode='Job Code*========'
         gender='Gender*======'
         salary='Annual Salary*=============';

   format salary dollar11.2;
   where jobcode contains 'FA' or jobcode contains 'ME';
   title 'Salary Expenses';
run;

 Note about code
ods html close;

Output: HTML

Creating a Customized Layout with BY Groups and ID Variables: Default HTML Output

[Creating a Customized Layout with BY Groups and ID Variables: Default HTML Output]


Program: Creating an HTML Report with the STYLE Option

options nodate pageno=1 linesize=64 pagesize=60 obs=15;
proc sort data=empdata out=tempemp;
   by jobcode gender;
run;

ods html file='your_file.html';

 Note about code
proc print data=tempemp (obs=10) split='*' style(HEADER) = 
                                  {fontstyle=italic}                                 
                                  style(DATA) = 
                                  {backgrouncolor=blue foreground = white};
 id jobcode;
   by jobcode;
   var gender salary;

 Note about code
   sum salary  / style(total)= [color=red];
   label jobcode='Job Code*========'
         gender='Gender*======'
         salary='Annual Salary*=============';

   format salary dollar11.2;
   where jobcode contains 'FA' or jobcode contains 'ME';
   title 'Expenses Incurred for';
   title2 'Salaries for Flight Attendants and Mechanics';
run;

ods html close;


Output: HTML with Styles

Creating a Customized Layout with BY Groups and ID Variables: HTML Output Using Styles

[Creating a Customized Layout with BY Groups and ID Variables: HTML Output Using Styles]

Previous Page | Next Page | Top of Page