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.
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.
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
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
Thanks Dan. I'll report the modified the plot back in here.Do you see other red flags in my approach?
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.
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.