I am having issues with one of my order variables. I see that the roworder variable works perfectly fine in the final dataset that I am then using for proc report. But as soon as this dataset runs in proc report, the roworder variable doesn't seem to be working anymore.
I have written out some examples along with what my current proc report statements is. I would like my final dataset to look like the "all" dataset Thank you! Any advice is greatly appreciated!
Final dataset: all
rowlabel col_1 roworder vorder
n 12 1 1
median 5 2 1
mean 8 3 1
n 10 1 2
median 5 2 2
mean 8 3 2
Output from proc report:
rowlabel col_1 roworder vorder
n 12 1 1
n 10 1 2
median 5 2 1
median 5 2 2
mean 8 3 1
mean 8 3 2
options nodate nonumber center Orientation=landscape
topmargin=.5in bottommargin=.4in leftmargin=.5in rightmargin=.5in;
ods listing close;
ods escapechar='^';
ods rtf file="&outpath&saveWordDoc..rtf" ;
title1 j=l font='Courier New' h=8pt "&titlename1 ^n &titlename2 ^n &titlename3" j=r "&sysdate9. &systime";
title2 j=l font='Courier New' h=8pt "&titleName4";
footnote j=l font='Courier New' h=8pt "&saveWordDoc..rtf" j=r "Page ^{thispage} of ^{lastpage}" ;
proc report nowd center spanrows missing split='^' data=all list out=test
style(report)=[width=100% frame=void rules=none cellspacing=0 padding=1pt font=('Courier New', 8pt)]
style(header)=[bordertopcolor=balck bordertopwidth=1
borderbottomcolor=black borderbottomwidth=1
background=white font=('Courier New', 8pt) textalign=c ]
style(column)=[font=('Courier New', 8pt) ASIS=ON ] ;
columns _PB_page vorder roworder rowlabel ("X^(N=&N1.)" col_1 col_12) ("Y^(N=&N2)" col_2 col_22) ("Total^(N=&N3)" col_3 col_32) ("p-value LS Means (95% CI)" col_4);
define _PB_page/group noprint;
define vorder/order noprint;
define vid/order noprint;
define roworder/order noprint;
define rowlabel/display '' style(column)=[width=1.5in] flow;
define col_1/display 'OBS' style(column)=[width=1in] center flow;
define col_12/display 'CHG' style(column)=[width=1in] center flow;
define col_2/display 'OBS' style(column)=[width=1in] center flow;
define col_22/display 'CHG' style(column)=[width=1in] center flow;
define col_3/display 'OBS' style(column)=[width=1in] center flow;
define col_32/display 'CHG' style(column)=[width=1in] center flow;
define col_4/ style(column)=[width=1in] center flow;
break after _PB_page/page ;
compute after vorder;
line '^S={font_face=arial font_size=1pt}';
endcomp;
compute after _page_/ style={bordertopcolor=black bordertopwidth=1 just=l font_face='Courier New' font_size=8pt};
line "&foot1.";
line "&foot2.";
endcomp;
run;
ods _all_ close;
ods listing;
Since 1 comes before 2 I don't see that the vorder variable is working incorrectly but that it has the incorrect values.
Perhaps you want
rowlabel col_1 roworder vorder n 12 1 11 median 5 2 12 mean 8 3 13 n 10 1 21 median 5 2 22 mean 8 3 23
and use VODER without roworder.
Since 1 comes before 2 I don't see that the vorder variable is working incorrectly but that it has the incorrect values.
Perhaps you want
rowlabel col_1 roworder vorder n 12 1 11 median 5 2 12 mean 8 3 13 n 10 1 21 median 5 2 22 mean 8 3 23
and use VODER without roworder.
That's not a bad idea, let me go ahead and try it that way! Thank you!
Thank you, that worked!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.