Hello:
I wonder how do you span rows for nested group variables in proc report. The output of the following code
ods rtf file='class.rtf';
proc report data=sashelp.class;
column sex age height weight;
define sex / group;
define age/ group;
define height / analysis mean f=8.1;
define weight / analysis mean f=8.1;
run;
ods rtf close;
will generate a table like
Sex |
Age |
Height |
Weight |
F |
11 |
51.3 |
50.5 |
|
12 |
58.1 |
80.8 |
|
13 |
60.9 |
91.0 |
|
14 |
63.6 |
96.3 |
|
15 |
64.5 |
112.3 |
M |
11 |
57.5 |
85.0 |
|
12 |
60.4 |
103.5 |
|
13 |
62.5 |
84.0 |
|
14 |
66.3 |
107.5 |
|
15 |
66.8 |
122.5 |
|
16 |
72.0 |
150.0 |
where gender is only display for the first nested age group. However for other age groups, an empty cell (with borders) is still displayed under Sex and I wonder how to either merge gender values with empty cells below or make the top border invisible for empty cells under Sex?
Thanks,
Peter
You didn't post the output you want to see yet ? proc report data=sashelp.class nowd; column sex dummy age height weight; define sex / group noprint; define dummy/computed 'sex'; define age/ group; define height / analysis mean f=8.1; define weight / analysis mean f=8.1; compute dummy/length=10 character; if not missing(sex) then _sex=sex; dummy=_sex; endcomp; run;
proc report data=sashelp.class nowd spanrows; column sex age height weight; define sex / group; define age/ group; define height / analysis mean f=8.1; define weight / analysis mean f=8.1; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: