I'm using the code below and want DAYS to be summarized in order from day -28 to day +28, however for the negative days, each page orders the days like they were positive. For example page one of the table goes from day -21 to day -28 instead of from day -28 to day -21, etc.
proc report data=final out=tvalid.v_&pgmname nowd headline split='|' missing/* style = [outputwidth=100%] */
style(header)=[asis=on just=center protectspecialchars=off]
style(column)=[asis=on just=center protectspecialchars=off] ;
column pgbrkvar period periodc diary_day order_ stat_cat col1;
define pgbrkvar / order noprint;
define period / order noprint;
define periodc / order style=[just=l cellwidth=1.1in] "Period";
define diary_day / order style=[just=l cellwidth=1.1in] "Day";
define order_ / order noprint;
define stat_cat / order style=[just=l cellwidth=1.1in] "Statistic";
define col1 / display style=[just=c cellwidth=0.7in] "(N=&g.)";
break after pgbrkvar /page;
compute before;
line ' ';
endcomp;
run;
@msecic wrote:
I'm using the code below and want DAYS to be summarized in order from day -28 to day +28 ...
In general, if you want values to appear in numeric order rather than alphabetical order, you would use
define variablename / order=internal;
This assumes that the values of the variable are numeric, and not character values like '-28'.
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.