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

Hello, I am looking at significant interaction and want to produce error bars in SAS. I  am using PROC LOGISTIC and I used the LRT test to determine significant interactions. I will include a sample diagram of what the graphs should look like.

 

proc logistic data=multi descending;
class damage(ref=first) smell(ref=first) smokeinlive(ref=first) employ(ref=first) pain(ref=first) clinicalinsomnia(ref=first) sleepquality1(ref=first) everasthma(ref=first) evercb(ref=first) evercopd(ref=first) depression(ref=first) everptsd(ref=first)/param=reference;
model everanxiety=damage smell smokeinlive employ clinicalinsomnia sleepquality1 pain everasthma evercb evercopd depression everptsd employ*sleepquality1 smokeinlive*sleepquality1;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

One way to do this is to use the EFFECTPLOT statement and ask for an interaction plot. Notice that since you have more than two explanatory variables, you must specify values for the variables that do not appear in the plot. There are several ways to do this, but PROC PLM will choose the reference values by default, which is probably what you want. 

 

Since I don't have your data, here is an example that shows how to get the plot for some data in the Sashelp.cars data set:

data cars;
set sashelp.cars;
Y = (origin='Asia');   /* make binary response var */
if type not in ('Hybrid','Truck') AND cylinders in (4,6);
run;

proc logistic data=cars descending;
class Type(ref=first) Cylinders(ref=first) DriveTrain(ref=first) / param=reference;
model Y = Type Cylinders DriveTrain Type*Cylinders;
store logiModel;
run;

/* plot interactions. See
   https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html
*/
proc plm restore=logiModel noinfo;
   effectplot interaction(x=Type sliceby=DriveTrain) / cluster clm connect; 
run;

 

InteractionPlot1.png

If you don't want the default choices for the other explanatory variables, you can use the AT= option to override the default:

proc plm restore=logiModel noinfo;
   effectplot interaction(x=Type sliceby=DriveTrain) / at(Cylinders='6') cluster clm connect; 
run;

For more information about the EFFECTPLOT and PROC PLM, see

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

One way to do this is to use the EFFECTPLOT statement and ask for an interaction plot. Notice that since you have more than two explanatory variables, you must specify values for the variables that do not appear in the plot. There are several ways to do this, but PROC PLM will choose the reference values by default, which is probably what you want. 

 

Since I don't have your data, here is an example that shows how to get the plot for some data in the Sashelp.cars data set:

data cars;
set sashelp.cars;
Y = (origin='Asia');   /* make binary response var */
if type not in ('Hybrid','Truck') AND cylinders in (4,6);
run;

proc logistic data=cars descending;
class Type(ref=first) Cylinders(ref=first) DriveTrain(ref=first) / param=reference;
model Y = Type Cylinders DriveTrain Type*Cylinders;
store logiModel;
run;

/* plot interactions. See
   https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html
*/
proc plm restore=logiModel noinfo;
   effectplot interaction(x=Type sliceby=DriveTrain) / cluster clm connect; 
run;

 

InteractionPlot1.png

If you don't want the default choices for the other explanatory variables, you can use the AT= option to override the default:

proc plm restore=logiModel noinfo;
   effectplot interaction(x=Type sliceby=DriveTrain) / at(Cylinders='6') cluster clm connect; 
run;

For more information about the EFFECTPLOT and PROC PLM, see

Madame_O
Fluorite | Level 6

Sorry for the late response, I was able to figure it out before anyone saw the post. But thank you so much!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 663 views
  • 2 likes
  • 2 in conversation