number | year1 | year2 | year3 | year4 |
Males | 6,621 | 7,076 | 7,194 | 7,135 |
Females | 5,047 | 5,530 | 5,426 | 5,495 |
Persons(d) | 11,668 | 12,606 | 12,620 | 12,630 |
Rate | ||||
Males | 2.3 | 2.4 | 2.2 | 2.4 |
Females | 2.0 | 2.0 | 2.2 | 2.3 |
Persons(d) | 2.1 | 2.2 | 2.2 | 2.3
|
How should I format the output?
proc report nowd data=sashelp.class;
col name sex age weight height;
compute height;
if sex='F' then do;
do i = 3 to 5;
call define(i,'format','dollar8.2');
end;
end;
endcomp;
run;
I *think* you can add a grouping variable and then conditionally format the lines using a COMPUTE statement.
@walterwang wrote:
number year1 year2 year3 year4 Males 6,621 7,076 7,194 7,135 Females 5,047 5,530 5,426 5,495 Persons(d) 11,668 12,606 12,620 12,630 Rate Males 2.3 2.4 2.2 2.4 Females 2.0 2.0 2.2 2.3 Persons(d) 2.1 2.2 2.2 2.3
How should I format the output?
proc report nowd data=sashelp.class;
col name sex age weight height;
compute height;
if sex='F' then do;
do i = 3 to 5;
call define(i,'format','dollar8.2');
end;
end;
endcomp;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.