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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- plotting same criterion, two predictors

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

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

Posted 04-15-2021 02:58 AM
(295 views)

Dear community,

I have a dataset with three variables, in which I ran a multiple regression model with one criterion/RMET and two predictors LIT and POP.

I would like a scatter plot + regression line for both predictors, in the same graph.

So far I have been unable to do so using REG or SGPLOT. The latter allows to have grouped data, so that if I wanted to plot, say, the RMET/Literary regression line for men vs. women, I could easily do so, and even color them differently. But that is not what I want.

I would like one graph with RMET in the y axis, and both LIT and POP on the x axis (they are both standardized vars), with say a blue scatter and reg line for LIT and a red scatter and reg line for POP.

I attach the datafile in excel format.

Thanks in advance.

Eman

Suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions

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

2 predictors and 1 dependent variable is a 3 dimension problem. The predictors are used as pairs, i.e. coordinates from a plane, the result is a third dimension.

So if you can't draw one by hand and show us what you think you want this to look like you are likely out of luck unless you have access to Proc G3D.

You can overlay graphs with two different X variables:

Proc sgplot data=yourdata;

scatter x=predictor1 y=result ;

scatter x=predictor2 y=result;

run;

Or Series or other plots.

Interpretation? I don't know.

4 REPLIES 4

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

2 predictors and 1 dependent variable is a 3 dimension problem. The predictors are used as pairs, i.e. coordinates from a plane, the result is a third dimension.

So if you can't draw one by hand and show us what you think you want this to look like you are likely out of luck unless you have access to Proc G3D.

You can overlay graphs with two different X variables:

Proc sgplot data=yourdata;

scatter x=predictor1 y=result ;

scatter x=predictor2 y=result;

run;

Or Series or other plots.

Interpretation? I don't know.

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

Thank you!

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

Read this article to understand why your description will not actually work:

"Visualize multivariate regression models by slicing continuous variables"

What most people do is to create a sliced fit plot in which you set the value of one predictors (often to the mean value) and then plot the predicted response as a function of the second predictor. SAS helps with this task: Use the SLICEFIT option in the EFFECTPLOT statement, which is supported in several regression procedures.

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

Thank you Rick.

For a simple plot of the two predictors on the same graph, the solution with SGPLOT reported above works. Of course, as noted, this is not the same as reporting the results of a multiple regression, for which I will be reading the documents you shared.

Eman

SAS is headed **back** to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

**Interested in speaking?** Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.