Thursday, April 3, 2008

Identifying Observations - ID (suppress OBS) v.s. NOOBS + BY-ID Group

Use the ID statement to identify observations.
Combine the BY and ID statements to produce special formatting.

proc print data=ia.empdata;
id JobCode;
var EmpID Salary;
run;

When the ID and BY statements specify the same variable,
the Obs column is suppressed
the BY line is suppressed
the ID/BY variable prints in the leftmost column
each ID/BY value only prints at the start of each BY group (and on the subtotal line, if a SUM statement is used).

Specify JobCode in the BY and ID statements to change the report format.

proc sort data=ia.empdata out=work.empdata;
by JobCode;
run;
proc print data=work.empdata;
by JobCode;
id JobCode;
sum Salary;
run;

No comments:

Post a Comment