BookmarkSubscribeRSS Feed
msecic
Calcite | Level 5

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;

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@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'.

--
Paige Miller
Cynthia_sas
Diamond | Level 26
...and also, without data, no one can test your code, so we don't know whether your variable is character or numeric.
Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1372 views
  • 0 likes
  • 3 in conversation