Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- SAS SURVEYREG procedure to plot an interaction?

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-12-2021 05:42 PM
(1295 views)

Hi everyone,

I was wondering if anyone knows whether you can graphically display a regression line that also shows a categorical*continuous interaction using proc **surveyreg**?

exposure=categorical

outcome=continuous

interaction= categorical*continuous

covariates used = continuous + categorical

This is basically how I would like it to look:

the x-axis has the continuous variable from the interaction term displayed

the y-axis has the continuous outcome displayed

Then, there would be 4 different lines to represent the categorical variable (it has 4 levels)

If anyone has a helpful link or a code that I could follow, that would be great!

Thanks in advance,

Sara

10 REPLIES 10

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sara.

PROC SURVEYREG doesn't produce this kind of plot, but you could use the STORE statement and PROC PLM. For example,

proc surveyreg data=sashelp.class;

class sex;

model weight=sex|height;

store sreg;

run;

proc plm restore=sreg;

effectplot slicefit(sliceby=sex);

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Zard,

Thanks so much for your reply. That did work. Just one more follow-up question if you don't mind; is there anyway to do this (e.g., use PLM to plot the interaction) with a multiply imputed dataset? I used multiple imputation with the survey procedures to model my regression.

Thanks in advance!

Sara

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sara.

I'm not aware of a way to do this, since PROC MIANALYZE does not have a STORE statement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Well, you can use ODS OUTPUT to get various datasets from MIANALYZE. I would think the parameterestimates dataset would work. You might have to merge it back against the original data, but then you could use SGPLOT to get what you want (I think). Check out the last example in the PROC MIANALYZE documentation to see if that looks like it might be useful.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Could you kindly share any example code for using the parameterestimates dataset from proc mianalyze to plot an interaction?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

*> is there anyway to do this (e.g., use PLM to plot the interaction) with a multiply imputed dataset? I used multiple imputation with the survey procedures to model my regression. *

Do you want the final model (averaged over all imputations), or do you want a plot for each set of imputed values? If you want B plots, one for each imputed value, you can use a BY statement in the survey procedures, then use the PLOTBY= option on the EFFECTPLOT statement. For examples, see the article "Use the EFFECTPLOT statement to visualize regression models in SAS."

If you want the averaged model, use the final parameter estimates to build the predictive model in the DATA step.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello

Could you kindly share any example code for using the parameterestimates dataset from proc mianalyze to plot an interaction?

Could you kindly share any example code for using the parameterestimates dataset from proc mianalyze to plot an interaction?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Follow the ideas in the article "How to create a sliced fit plot in SAS."

The MIANALYZE procedure creates a ParameterEstimates table. Use those estimates to score the model for a range of values for the continuous variable and for each level of the categorical variable. Then use a SERIES stmt in PROC SGPLOT with the GROUP= option to display the lines for each level of the categorical variable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for your reply. Actually I am a new SAS user. Any help on using ParameterEstimates table from Proc MIanalyze to score a model for a range of values? Many thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Everybody was new once. Read the article and the links and you will begin to learn.

Two tips about getting help:

1. Creating a new thread is better than jumping on an old thread started by someone else years ago.

2. Short questions tend to get short answers. If yu want a longer response, ask a detailed question that includes sample data, sample program, and example output.

⏰

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.** **

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.