BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Hi Folks:

 

How to re-organize the plot shown below to align same age groups across the columns? I'd like to have Distant.. among 0-44yr, Localized.. among 0-44yr, and Regional... 0-44yr under the first column and the same for the rest of the 3 columns. Right now, different age groups are lined up. For example:  you'll find 0-44yr, 60-75yr and 45-59yr age groups under the first column. Data used for this plot is attached to the post.

 

plot unaligned.png

proc sgpanel data=MERGED_HAZARD2 noautolegend;
label PCT_MISS100='Percent of Incomplete Data' RSD='RELATIVE SURVIVAL DIFFERENCE' ASD='ABS SURIVAL DIFFERENCE';
panelby group/ novarname columns=4 rows=3;
styleattrs DATACONTRASTCOLORS=(black red);
series  x=PCT_MISS100 y=RSD /lineattrs=(pattern=solid);
series  x=PCT_MISS100 y=ASD /lineattrs=(pattern=solid);
keylegend/  title="Date Type" position=bottom;
colaxis label='percent of missing in data' grid;
rowaxis label='RELATIVE AND ABSOLUTE SURVIVAL DIFFERENCE' grid;
title "Effect of missing in X on the estimates of Y model"; 
run;

Thanks for your time and halp.

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

To do a custom sort order like this in SGPANEL, create an additional "sort" column, where you assign the numbers 1-N to your unique "group" column values, Make sure the 1, 5, and 9 are associated to your "0-44yr" values, 2, 6, and 10 to your "45-59yr" values, and so on. Then, PROC SORT the data on the "sort" column. In your SGPANEL PANELBY statement, set SORTORDER=DATA. That way, the current ordering of your "group" column should remain intact.

 

Hope this helps!

Dan

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

To do a custom sort order like this in SGPANEL, create an additional "sort" column, where you assign the numbers 1-N to your unique "group" column values, Make sure the 1, 5, and 9 are associated to your "0-44yr" values, 2, 6, and 10 to your "45-59yr" values, and so on. Then, PROC SORT the data on the "sort" column. In your SGPANEL PANELBY statement, set SORTORDER=DATA. That way, the current ordering of your "group" column should remain intact.

 

Hope this helps!

Dan

Cruise
Ammonite | Level 13

@DanH_sas 

Thanks Dan. I'll report the modified the plot back in here.Do you see other red flags in my approach?

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

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
  • 732 views
  • 1 like
  • 2 in conversation