I am running Proc Logistic. is there a way to run the class statement by putting the value instead of the format name? So in order to get my command to work I had to run the following:
proc logistic data = recode ;
class agegp (ref='2.age grp 45-65') sex (ref='1.Male') /param = ref;
model Y (event='1. <64') = agegp sex;
run;
So in this case, agegroup=2 and sex=1 are my reference groups (my format is value.category). I have tried doing the following:
proc logistic data = recode ;
class agegp (ref=2) sex (ref=1) /param = ref;
model Y (event=1) = agegp sex;
run;
The code above gives me a syntax error. I am hoping to avoid copying and pasting the format names. And hopefully make my code shorter.
Add a FORMAT statement to the PROC to clear the assigned formats from the variables.
proc logistic data = recode ;
format agegp sex ;
class agegp (ref=2) sex (ref=1) /param = ref;
model Y (event=1) = agegp sex;
run;
If a format is assigned to the variable, the ref= syntax requires the use of the formatted value. See The Logistic Procedure>Syntax>CLASS Statement>REF= for the word on this.
Steve Denham
Add a FORMAT statement to the PROC to clear the assigned formats from the variables.
proc logistic data = recode ;
format agegp sex ;
class agegp (ref=2) sex (ref=1) /param = ref;
model Y (event=1) = agegp sex;
run;
Sweet! I didn't know you could clear formats like that.
Steve Denham
Thanks! I this works... but is there a way to have the best of both worlds.. not having to type in the format in the class statement AND have it output with formats?
Go to work for SAS and re-write PROC LOGISTIC?
The default reference is the largest value (unless you add the DESCENDING option).
So code your formats so that the reference value is the largest value.
Or smallest and use ref=first
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.