Hello,
I need some help with this problem i am trying to solve. I am running a logistic regresssion model. After running the full model, i removed one variable from the full model. I want to see how removing that one variable affected the betas (parameter estimates) of the other variables in the model.
I will be very grateful if i can get an answer to this.
Thanks
I modified the solution you gave and it worked perfectly well. Thank you so much for your input Reeza.
Below is the complete code for anyone with similar problem:
/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
model read=sex race hospital snf;
run;
ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital;
model read=sex race hospital;
run;
proc sort data=model1;
by variable;
proc sort data=model2;
by variable;
run;
data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=((estimate1-estimate2)/estimate2)*100;
run;
proc print data=comparison;
run;
Sorry, It's unclear what your question is. If you have a question on code, please include your current code.
Thank you for your response.
Assuming that i have a logisic regression model with the full model below:
proc logistic data=temp;
class sex race hospital snf;
model read=sex race hospital snf;
run;
and then i reduced model as below (it is without the variable snf)
proc logistic data=temp;
class sex race hospital;
model read=sex race hospital;
run;
I want to see how removing snf from the full model changed the betas (parameter estimates) for other variables in the reduced model.
/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
model read=sex race hospital snf;
run;
ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital snf;
model read=sex race hospital;
run;
data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=estimate1-estimate2;
run;
I modified the solution you gave and it worked perfectly well. Thank you so much for your input Reeza.
Below is the complete code for anyone with similar problem:
/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
model read=sex race hospital snf;
run;
ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital;
model read=sex race hospital;
run;
proc sort data=model1;
by variable;
proc sort data=model2;
by variable;
run;
data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=((estimate1-estimate2)/estimate2)*100;
run;
proc print data=comparison;
run;
Use backward seletion + include= option.
data class;
set sashelp.class;
if _n_ in (1:9) then y=1;
else y=0;
run;
proc logistic data=class;
class sex;
model y(event='1')= sex age weight height/details selection=backward include=3;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.