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

Hi! I'm an experienced beginner with SAS and am running a logistic regression. I used the effectplot statement with proc logistic to visualize an interaction between 2 categorical variables, and I'd like to capture the underlying data for that effect plot. I read through the User Guide on Proc Logistic and I checked the list of ODS Table Names and didn't see anything related to this. I'm using the latest version of SAS University and would appreciate any help. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
That's because you have the interaction option, I didn't have that in my test - you didn't post code so I couldn't know you were using that option.

AFAIK these are not documented data sets. The datasets are often complicated because they're pretty much solely for graphing. If you get the graph template via PROC TEMPLATE it may help you understand what is doing what though.

View solution in original post

6 REPLIES 6
Reeza
Super User

 

ods output slicefitpanel = want;

Use ODS TRACE method to find the table name in these cases.

Here's some instructions and explanations on how to capture output that is shown.
https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods...

 

 


@panchang wrote:

Hi! I'm an experienced beginner with SAS and am running a logistic regression. I used the effectplot statement with proc logistic to visualize an interaction between 2 categorical variables, and I'd like to capture the underlying data for that effect plot. I read through the User Guide on Proc Logistic and I checked the list of ODS Table Names and didn't see anything related to this. I'm using the latest version of SAS University and would appreciate any help. Thanks!


 

panchang
Fluorite | Level 6

Thanks for the quick response! I used ODS trace and the ODS table name turned out to be Interaction Plot, not Slice Fit Panel. Here is the code I used to get the run the regression, and export the output data for the effect plot:

 

ods output InteractionPlot = output ;

proc logistic data = models.full2; 
	class city2 hhsize2 housemod2 ctbsafe2 floor2 watfreq_pre   
		/ param = ref ;
	model avoid_pre = city2 age_pre possess hhsize2 housemod2 ctbsafe2
	 	floor2 yearsinslum3 watfreq_pre   
		ctbsafe2*watfreq_pre  /* / expb */ 	; 
		/* oddsratio ctbsafe2 / at(watfreq_pre = all) diff = ref 	; */
		effectplot interaction (x = watfreq_pre sliceby = ctbsafe2) ; 
		/* output out = out_avoid predicted = preds; */
	run; 


proc export data = output
	dbms = xlsx
	outfile= "/folders/myfolders/sasuser.v94/impact/analysis/output-av.xlsx"
	replace;
	run; 

 

However, I'm having a hard time understanding the output. The first 5 lines are blank (even though there are no missing values), and the column names are unclear to me. I've pasted the first several lines below, including column names. Is there a help page somewhere to figure out what these are? Thank you!

 

_PREDICTED_XCLAS_GROUP_INDEX_XCLAS_OBS_PREDICTED_OBS_Y_OBS_OBSNUM_YVAR_OBS_VALUE
  010    
  011    
  120    
  121    
  1210.11893273011
  1210.220645038021
  1210.074104704031
  1210.063730638041
Reeza
Super User
That's because you have the interaction option, I didn't have that in my test - you didn't post code so I couldn't know you were using that option.

AFAIK these are not documented data sets. The datasets are often complicated because they're pretty much solely for graphing. If you get the graph template via PROC TEMPLATE it may help you understand what is doing what though.
panchang
Fluorite | Level 6

I see. Basically, the interaction plot produced by the code is attached - I want to re-orient it to a bar graph or something else that might be easier to visualize. My idea was to make 4 bars, with different combinations for ctbsafe= 0, 1, and watfreq_pre = 0, 1. So I thought if I just downloaded the data into Excel or something that might be easier, but since the output data looks so confusing, I'm not sure how to proceed. It seems like my options are 1) use ODS graphics to manipulate the interaction plot (but I read that ODS graphics is not available with SAS University), or 2) Use PROC TEMPLATE to figure out what the graph dataset is giving me. Does that sound right?

PaigeMiller
Diamond | Level 26

@panchang wrote:

I see. Basically, the interaction plot produced by the code is attached - I want to re-orient it to a bar graph or something else that might be easier to visualize. My idea was to make 4 bars, with different combinations for ctbsafe= 0, 1, and watfreq_pre = 0, 1. So I thought if I just downloaded the data into Excel or something that might be easier, but since the output data looks so confusing, I'm not sure how to proceed. It seems like my options are 1) use ODS graphics to manipulate the interaction plot (but I read that ODS graphics is not available with SAS University), or 2) Use PROC TEMPLATE to figure out what the graph dataset is giving me. Does that sound right?


My opinion is that an interaction plot is not better when re-displayed as bars. I think that would be a mistake and make the interaction harder to visualize and interpret. Right now, you can see the two lines on the plot are not parallel, that is an interaction. I have no idea what an interaction looks like if you turn them into bars.

--
Paige Miller
panchang
Fluorite | Level 6

It would take too long to explain, but seeing how the predicted probabilities change with different combinations of the two binary variables I am interacting would actually assist in interpreting the trends from this regression. Other outside readers have suggested this as well. Thanks for your help.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6 replies
  • 1448 views
  • 0 likes
  • 3 in conversation