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;


sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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