DATA Step, Macro, Functions and more

PROC REPORT, can you place descriptive text in a BREAK or RBREAK row?

Accepted Solution Solved
Reply
Respected Advisor
Posts: 2,649
Accepted Solution

PROC REPORT, can you place descriptive text in a BREAK or RBREAK row?

proc report data=sashelp.class;
    columns sex age height weight;
    define sex/group;
	define age/group;
    define height/analysis mean format=10.2 "Height Mean";
    define weight/analysis mean format=10.1 "Weight Mean";
	break after sex/summarize style=[font_style=italic];
	rbreak after/summarize style=[font_style=italic];
run;

I would like the BREAK rows to have the text at the left hand side in column 1 "Female Mean" or "Male Mean", and in the RBREAK row I'd like the text "Overall Mean". How can this be done?

 

--
Paige Miller

Accepted Solutions
Solution
‎02-01-2018 07:57 AM
Super User
Posts: 10,615

Re: PROC REPORT, can you place descriptive text in a BREAK or RBREAK row?

Posted in reply to PaigeMiller
data class;
 length sex $ 40;
 set sashelp.class;
 sex=ifc(sex='F','Female','Male');
run;
proc report data=class nowd; 
    columns sex age height weight;
    define sex/group;
	define age/group;
    define height/analysis mean format=10.2 "Height Mean";
    define weight/analysis mean format=10.1 "Weight Mean";
	break after sex/summarize style=[font_style=italic];
	rbreak after/summarize style=[font_style=italic];
	compute after sex;
	  sex=catx(' ',sex,'Mean');
	endcomp;
	compute after;
	  sex=catx(' ','Overall','Mean');
	endcomp;
run;

View solution in original post


All Replies
SAS Super FREQ
Posts: 9,257

Re: PROC REPORT, can you place descriptive text in a BREAK or RBREAK row?

Posted in reply to PaigeMiller
Hi:
You will need 2 COMPUTE blocks. Refer to the techniques shown in this paper: https://www.sas.com/content/dam/SAS/support/en/technical-papers/SAS0431-2017.pdf

cynthia
Solution
‎02-01-2018 07:57 AM
Super User
Posts: 10,615

Re: PROC REPORT, can you place descriptive text in a BREAK or RBREAK row?

Posted in reply to PaigeMiller
data class;
 length sex $ 40;
 set sashelp.class;
 sex=ifc(sex='F','Female','Male');
run;
proc report data=class nowd; 
    columns sex age height weight;
    define sex/group;
	define age/group;
    define height/analysis mean format=10.2 "Height Mean";
    define weight/analysis mean format=10.1 "Weight Mean";
	break after sex/summarize style=[font_style=italic];
	rbreak after/summarize style=[font_style=italic];
	compute after sex;
	  sex=catx(' ',sex,'Mean');
	endcomp;
	compute after;
	  sex=catx(' ','Overall','Mean');
	endcomp;
run;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 100 views
  • 0 likes
  • 3 in conversation