BookmarkSubscribeRSS Feed
Peter_Y
Calcite | Level 5

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

2 REPLIES 2
Ksharp
Super User
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;


Ksharp
Super User
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;


hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2164 views
  • 0 likes
  • 2 in conversation