Monday, March 17, 2008

PROC PRINT LABEL-SPLIT, WHERE

CONTAINS - selects observations that include ? the specified substring.

where LastName ? 'LAM';

OUTPUT: (LAMBERT, BELLAMY, and ELAM are selected.)


proc print data=tempemp 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 in ('PT1','PT2');
title 'Expenses Incurred for';
title2 'Salaries for Pilots';
run;

id jobcode;
The ID statement identifies observations by using the formatted values of the variables that you list instead of by using observation numbers.

sum salary;
The SUM statement totals values of numeric variables. Here the SUM statement totals the values of Salary for each BY group and for the whole report.
label jobcode='Job Code*========'
gender='Gender*======'
salary='Annual Salary*=============';

The LABEL statement associates a label with each variable for the duration of the PROC PRINT step. When you use SPLIT= in the PROC PRINT statement, the procedure uses labels for column headings.
format salary dollar11.2;

The FORMAT statement assigns the DOLLAR12.2 format to Salary for this report.
where jobcode in ('PT1','PT2');

The WHERE statement selects only observations where the value of Jobcode is either PT1 or PT2.

No comments: