October 2009
Beginner
636 pages
13h 35m
English
In the previous example, the DATA step calculated the new variables. This example shows you how to calculate the new columns in the template definition itself. It is as simple as adding a COMPUTE statement within the DEFINE block for each column. Only the changed DEFINE blocks are shown in the following code. This definition assigns the name HR_CALC to the template.
ODS PATH WORK.NEWTEMP(UPDATE) SASHELP.TMPLMST(READ); proc template; define table tables.hr_calc; column Department AnnualSalary BonusAmt NewSal; . . . more code . . . define BonusAmt; compute as AnnualSalary * .05; header = '#Bonus#@5%'; format=7.2; end; define NewSal; compute as AnnualSalary + BonusAmt; header = 'Adjusted'; format=dollar14.2; ...
Read now
Unlock full access