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
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.
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.
Thank you! What does the param=glm mean?
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.
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!
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.