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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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