BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
steph_
Fluorite | Level 6

Hello!

 

I am trying to write code for multiple logistic regression and cannot find what code to use.

 

My outcome/y variable is binary (yes or no but recoded to be numeric) and explanatory/x variables are mainly continuous but there is one binary (recoded to be numeric) variable too.

 

Could someone assist me with some basic code for a starting point?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Very simple for basic model fit. Assuming your response is Y with values 0 or 1 where 1 is the event of interest and your data set is named MYDATA:

proc logistic data=mydata;

class <list any categorical predictors> / param=glm;

model y(event='1') = <list all predictors, continuous and categorical>;

run;

See other examples in the PROC LOGISTIC documentation - Getting Started and Examples sections. There are many options for additional information.

View solution in original post

3 REPLIES 3
StatDave
SAS Super FREQ

Very simple for basic model fit. Assuming your response is Y with values 0 or 1 where 1 is the event of interest and your data set is named MYDATA:

proc logistic data=mydata;

class <list any categorical predictors> / param=glm;

model y(event='1') = <list all predictors, continuous and categorical>;

run;

See other examples in the PROC LOGISTIC documentation - Getting Started and Examples sections. There are many options for additional information.

steph_
Fluorite | Level 6

Thank you! What does the param=glm mean?

StatDave
SAS Super FREQ

Again, see that documentation for info on all options, but PARAM=GLM creates the typical 0,1 coded design columns that most people use to represent categorical predictors. But if your only categorical predictors are binary and you already have them coded as 0,1, then you can just omit the CLASS statement.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 360 views
  • 3 likes
  • 2 in conversation