I have a binary outcome, with 1="Yes" and 2="No". Can I run logistic regression with the given formatting? Or, do I need to convert the values to 1="Yes" and 0="No", especially when I am interested in probability of "Yes"?
You can run PROC LOGISTIC on the data you have. The response variable can be numeric or character, and it can have a format or not.
By default, the procedure will model the lower value of the (formatted) response variable, but you can use the (EVENT='value') option to override. For example, the following sets the formatted value of the response, thus overriding the default:
proc format;
value YorN 1="Yes" 2="No";
run;
data a;
set sashelp.class;
if sex="M" then Y=1;
else Y=2;
format Y YorN.;
run;
proc logistic data=a;
model y(event="Yes") = height weight;
run;
Thanks! But, if the procedure models lower value by default, then shouldn't the default model in your example be the one with event="Yes" (as it has the value of 1)? My understanding so far is that the default model will be on the greater value. Or am I missing something?
I wrote a working program. Run it. Then change the syntax and rerun it. Experiment. That's how you will learn.
I think you will discover that since "No" comes before "Yes" in alphabetical order, the default for the formatted response is "No".
If you remove the format, the default response will be the smaller numerical value.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.