The SAS Output Delivery System and reporting techniques

span rows for nested group/order variable in proc report

Reply
Contributor
Posts: 25

span rows for nested group/order variable in proc report

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

Super User
Posts: 10,623

Re: span rows for nested group/order variable in proc report

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;


Super User
Posts: 10,623

Re: span rows for nested group/order variable in proc report

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;


Ask a Question
Discussion stats
  • 2 replies
  • 280 views
  • 0 likes
  • 2 in conversation