I am new to proc report. Using across to nest two variables together. However, all the results are not on the same row and are scattered
This is what I have:
THis is my code and sample data structure
Data have;
retain IGA group Week1 Week2 CatC CatN;;
length CatC $ 10.;
input IGA group Week1 Week2 CatC $ CatN;
cards;
1 3 . . N 1
1 3 . . Mean 2
2 3 1 1 N 1
2 3 2.3 2.0 Mean 2
3 3 3 3 N 1
3 3 1.9 2.0 Mean 2
4 3 3 3 N 1
4 3 0.9 1.3 Mean 2
5 3 4 4 N 1
5 3 1.7 1.3 Mean 2
;
ods tagsets.rtf file="&path.\output\Draft\&pgm..rtf" style=rtfdef startpage=yes nogtitle nogfootnote;
proc report data=have nowindows headline headskip SPANROWS split='|' spacing=4
style(header)={ just=center asis=on}
style(column)={asis=on}
style(report)={width=9 in};
column group CatN CatC (IGA, (Week1 Week2));
define IGA/across order=data style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on];
define group/order=data group "Age Group" style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=0.7in];
define CatN/order=data noprint;
define CatC /display 'Statistic' style(header)=[just=center fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=0.7in];
define Week1/display style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on cellwidth=0.7in ];
define Week2/display style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on cellwidth=0.7in ];
run;
ods tagsets.rtf close;
How do I get all N and mean to report on the same row across the IGA variable and weeks?
I found this article https://www.lexjansen.com/pharmasug/2012/TF/PharmaSUG-2012-TF20-SAS.pdf
I've tried the dummy variable method and that did not work.
Your data structure is not the same as in the article, where they use a single variable for gender (not separate M and F).
To use the code in the paper, I would suggest you reorganize your data in a longitudinal timeseries format, with a single variable representing week number.
This will also give you the flexibility to add additional weeks when needed.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.