Programming the statistical procedures from SAS

logistic regression

Reply
Occasional Contributor
Posts: 7

logistic regression

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

SAS Super FREQ
Posts: 3,555

Re: logistic regression

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;

 

Occasional Contributor
Posts: 7

Re: logistic regression

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?

SAS Super FREQ
Posts: 3,555

Re: logistic regression

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.

Ask a Question
Discussion stats
  • 3 replies
  • 170 views
  • 2 likes
  • 2 in conversation