BookmarkSubscribeRSS Feed
Mahip
Obsidian | Level 7

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"?

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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;

 

Mahip
Obsidian | Level 7

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?

Rick_SAS
SAS Super FREQ

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-2024.png

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.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 1293 views
  • 2 likes
  • 2 in conversation