BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26
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
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1171 views
  • 0 likes
  • 3 in conversation