BookmarkSubscribeRSS Feed
monday89
Fluorite | Level 6

I have the following table and I would like to merge and center the group by treatment groups

 

groupcategoryvalue
treatment156
treatment254
treament332
placebo145
placebo234
placebo323

 

Like this: 

dfdf.PNG

 

I tried:

 


proc report data=test nowindows split='~' spanrows
style(report)={font_size=9pt }
style(header)={just=center font_weight=bold font_size=9pt background=CXE0E0E0}
style(column)={font_size=9pt protectspecialchars=on};
column group category value;

run;

 

not sure what i am doing wrong

3 REPLIES 3
Reeza
Super User
Specify the variable as GROUP variable on the define statement and you can apply styling on the DEFINE statement for a specific variable as well.
monday89
Fluorite | Level 6

great thank you it works!

 

But now i have another issue. Currently I have only 2 groups: treatment and placebo, but if I add the third arm to be arm_3. I don’t want the order to change desc or ascending. It should be treatment, placebo, arm_3. If I add /group in the define, it doesn’t retain the order

 

Group

value

Treatment

112

Treatment

312

Treatment

423

Placebo

242

Placebo

343

Arm_3

324

Arm_3

324

I wrote the following:

proc report data=test   nowindows headline headskip;

      column group value;

      define group/ group "Treatment Group" width =14;

      define value/ group "value" width =14;

run;

 

I am getting this [I do not want to change the order of group]

Group

value

Arm_3

324

 

324

Placebo

242

 

343

Treatment

112

 

312

 

423

 

 

Reeza
Super User
Specify order=data assuming your order is specified. Otherwise your best bet is to recode them to numbers that will sort the way you want and apply a format to have the display labels you need.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 469 views
  • 0 likes
  • 2 in conversation