I have the following table and I would like to merge and center the group by treatment groups
group | category | value |
treatment | 1 | 56 |
treatment | 2 | 54 |
treament | 3 | 32 |
placebo | 1 | 45 |
placebo | 2 | 34 |
placebo | 3 | 23 |
Like this:
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
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 |
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.