Hello,
I can't seem to get the right order in my legend. my variables are coded in order that I want it to show
0=<80
1=80-90
2=>90
and the reference category is <80 but this is the plot I get:
It still has the order: 80-90, <80 , >90
and I want <80, 80-90, >90
My code used: (I tried to mess with ODS graphics but I couldn't understand)
proc logistic data=sbb descending plots=effect;
class finalcat3(ref='<80%');
model score= ugpa finalcat3/rsq lackfit cl;
run;
class finalcat3(ref='<80%' order=internal);
This forces SAS to use the internal order (0, 1, 2) when ordering the levels in the output.
@SASnewbiee wrote:
Hello,
I can't seem to get the right order in my legend. my variables are coded in order that I want it to show
0=<80
1=80-90
2=>90
and the reference category is <80 but this is the plot I get:
It still has the order: 80-90, <80 , >90
and I want <80, 80-90, >90
Character variables will have their values sorted alphabetically by default. That's what you are seeing. In general, you want to leave numeric variables as numeric variables, because numeric variables sort numerically (that's what you want) and then apply a custom format to them so they appear as 80-90, or as <80, or as >90.
Show me your code.
class finalcat3(ref='<80%' order=internal);
This forces SAS to use the internal order (0, 1, 2) when ordering the levels in the output.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.