Hello,
How can I include the variables in the model that are significant or not using proc logistic regression. I have variable sex turning out to be not significant enough and selection method removes the variable. But I would like to include Sex variable in the model as a mandatory variable. Is there an option in logistic regression procedure to manadatorily hold and keep the variables significant or not in the model and then to include the other variables based on the selection process? Thanks in advance!!
Code:
proc logistic ;
class Target Education Health_insurance Living_arrangement Age Sex;
model Target(event="1")= Education Health_insurance Living_arrangement Age Sex/ selection=stepwise;
run;
Estimates:
Parameter | DF | Estimate | Standard Error | Wald Chi-Square |
Pr > ChiSq |
Intercept | 1 | -3.0671 | 0.3528 | 75.5638 | <.0001 |
Education | 1 | 0.5504 | 0.2329 | 5.5839 | 0.0181 |
Health_insurance | 1 | 0.6883 | 0.2399 | 8.232 | 0.0041 |
Living_arrangement | 1 | 0.2728 | 0.1029 | 7.0353 | 0.008 |
Age | 1 | 1.0443 | 0.233 | 20.0887 | <.0001 |
Sex | 1 | 0.1972 | 0.0629 | 9.8295 | 0.512 |
Data:
Target | Education | Health_insurance | Living_arrangement | Age | Sex |
0 | -0.08264447 | -0.677142541 | 0.979974336 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | 0.915907427 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
1 | -0.57348838 | 1.055157965 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.57348838 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | 0.915907427 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | 3.014553778 | -1.04615533 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | -1.04615533 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 0.915907427 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | 0.979974336 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | 0.979974336 | 0.915907427 | -1.04615533 |
1 | -0.08264447 | -0.677142541 | 0.979974336 | -0.607323603 | -1.04615533 |
1 | 8.99941821 | 5.578245149 | 6.983458922 | -0.607323603 | 0.9539654 |
1 | -0.57348838 | 1.055157965 | 0.979974336 | 0.915907427 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | 0.979974336 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | 1.055157965 | 0.979974336 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | 3.014553778 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | 0.979974336 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | 0.979974336 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | 0.979974336 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | 0.979974336 | 0.915907427 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | 1.055157965 | -0.385145422 | 3.014553778 | -1.04615533 |
1 | -0.08264447 | 1.055157965 | 0.979974336 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
1 | -0.08264447 | -0.677142541 | 0.979974336 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | 1.055157965 | -0.385145422 | 0.915907427 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
1 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | 0.9539654 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | -0.607323603 | -1.04615533 |
1 | -0.57348838 | -0.677142541 | 0.979974336 | -0.607323603 | -1.04615533 |
0 | -0.08264447 | -0.677142541 | -0.385145422 | 0.915907427 | 0.9539654 |
Hello @Chapi,
Put those "mandatory" variables first in the MODEL statement and use the INCLUDE= option to specify their number.
Example:
model Target(event="1") = Sex Education Health_insurance Living_arrangement Age / include=1 <other effect selection options>;
include=2 would include the first two variables, i.e. Sex and Education, in every model.
If you don't want variables removed then don't use a selection method.
Since your code shown does not include a selection method then that is not the code you have been using and is only marginally related to your topic.
Yes I tried that, I got the desired results. But I am trying to know if there is a statement or option to tell proc logistic regression to mandatorily include some specific variables (weather or not significant) and apply selection method on other variables.
Yes thats right! I am marginally relating to my topic to keep it simple. But I have undated the code.
Hello @Chapi,
Put those "mandatory" variables first in the MODEL statement and use the INCLUDE= option to specify their number.
Example:
model Target(event="1") = Sex Education Health_insurance Living_arrangement Age / include=1 <other effect selection options>;
include=2 would include the first two variables, i.e. Sex and Education, in every model.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.