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
SAS Super FREQ
...and also, without data, no one can test your code, so we don't know whether your variable is character or numeric.
Cynthia

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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