turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Re: Graph Multiple Regression with 2 lines

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Hi everyone,

I am trying to create a graph for a multiple regression (used PROC GLM to create) with 9 covariates. I want to make a graph with two lines (druguse=0 and druguse=1), plugging in for 'typical' values of the other covariates (ie, age50, race=white, etc).

Is that even possible? I am using SAS Studio.

Here's what I've done so far:

PROC SGPLOT DATA=sample.name;

SCATTER X=BASELINE Y=CHANGE/GROUP=DRUGUSE;

REG X=BASELINE Y=CHANGE/CLI CLM NOMARKERS;

RUN;

However, this REG doesn't include all my covariates! Not sure what to do!

Accepted Solutions

Solution

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

I do not know the valid values of your continuous variables, but try something like this:

CLASS HARD_DRUGS INCOME2;

effectplot slicefit/ at(

AGE = 30

BMI = 25

MARI = 0

ALCOHOL = 1

CSMOKER = 1

HS = 1

ADHY2_ NHW = 0;

);

Whatever value you use on the right-hand side will determine the value at which the model is evaluated for the effectplot. The first continuous variable MODEL statement (AGG_MENT0 ) determines the continuous axis for the effect plot.

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Add GROUP=DRUGUSE to the REG statement as well.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

It gets really crazy ! Plus, doing that doesn't include my full model.

The full model has drug use, age, baseline score, bmi, income, high school, marijuana use, etc.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

LGrau wrote:

It gets really crazy ! Plus, doing that doesn't include my full model.

The full model has drug use, age, baseline score, bmi, income, high school, marijuana use, etc.

Which would make that a 7+ dimension graph. We don't really have good technology for displaying 3 dimensions and you want to display more than 4 more? In a single plot?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Typically a regression plot with multiple lines is only made when there is a CLASS variable (although there could be more than one) and a single continuous variable--the kind of graph you made with PROC SGPLOT. What is it you want? How do the other variables enter in?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

My Model is this:

PROC GLM DATA=BIOS6623.AGG_MENT;

CLASS INCOME2;

MODEL DELTAAGGMENT=AGG_MENT0 HARD_DRUGS AGE BMI MARI ALCOHOL CSMOKER INCOME2 HS ADHY2_ NHW/SOLUTION CLPARM;

TITLE "MODEL 1: FULL MODEL FOR CHANGE IN AGGREGATE MENTAL SCORE FOR ALL VARIABLES";

QUIT; TITLE;

I want to create a graph with two lines (Hard_Drugs=1 and Hard_Drugs=0), with age=50 race=NHW Mari=0 alcohol=0 HS=0 ADHY2=1 CSMOKER=0, etc.

This is the code I have so far, but it is not happening.

PROC SGPLOT DATA=BIOS6623.AGG_MENT;

TITLE "CHANGE IN AGGREGATE MENTAL SCORE";

SCATTER X=AGG_MENT0 Y=DELTAAGGMENT/GROUP=HARD_DRUGS;

REG X=AGG_MENT0 Y=DELTAAGGMENT/GROUP=HARD_DRUGS CLI CLM NOMARKERS;

RUN;TITLE;

TITLE "CHANGE IN AGGREGATE MENTAL SCORE";

SCATTER X=AGG_MENT0 Y=DELTAAGGMENT/GROUP=HARD_DRUGS;

REG X=AGG_MENT0 Y=DELTAAGGMENT/GROUP=HARD_DRUGS CLI CLM NOMARKERS;

RUN;TITLE;

Highlighted
## Re: Graph Multiple Regression with 2 lines

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

It might be that the EFFECT and EFFECTPLOT statements in many of the modeling procedures (but not GLM) can do what you want. Sorry, but I don't have time today to play with this.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

```
ods graphics on;
proc orthoreg data=sashelp.class;
class sex;
effectplot slicefit;
model weight = height age sex;
run;
```

See if this gets you going in the right direction. I hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

For a discussion and examples of using the EFFECTPLOT statement to slice and dice high-dimensional regression models, see "Use the EFFECTPLOT statement to visualize regression models in SAS."

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

This worked! However, it fits de line using the means of the covariates. Is there a way to fit with me specifying which values to use?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Yes. My blog post links to the documentation. You might want to look at the AT= option.

You can specify statistics (mean, min, max, midrange) or specify particular values:

effectplot / at(x=min max x=2 5 7);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

That gives me the error "VARIABLE CONFIGURATION IS NOT CURRENTLY SUPPORTED BY THE EFFECTPLOT STATEMENT"

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Please post your code and specify what version of SAS you are running.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

I'm using SAS Studio!

ods graphics on;

proc orthoreg data=BIOS6623.AGG_MENT;

CLASS HARD_DRUGS INCOME2;

effectplot slicefit/ cli clm;

model DELTAAGGMENT=AGG_MENT0 HARD_DRUGS AGE BMI MARI ALCOHOL CSMOKER INCOME2 HS ADHY2_ NHW;

run;

proc orthoreg data=BIOS6623.AGG_PHYS;

CLASS HARD_DRUGS INCOME2;

effectplot slicefit/ cli clm;

model DELTAAGGPHYS=AGG_PHYS0 HARD_DRUGS AGE BMI MARI ALCOHOL CSMOKER INCOME2 HS ADHY2_ NHW;

run;

proc orthoreg data=BIOS6623.LEU3N;

CLASS HARD_DRUGS INCOME2;

effectplot slicefit/ cli clm;

model DELTALEU3N=LEU3N0 HARD_DRUGS AGE BMI MARI ALCOHOL CSMOKER INCOME2 HS ADHY2_ NHW ;

run;

proc orthoreg data=BIOS6623.LOG10VLOAD;

CLASS HARD_DRUGS INCOME2;

effectplot slicefit/ cli clm;

model LOGVLOAD= LOGVLOAD0 HARD_DRUGS AGE BMI MARI ALCOHOL CSMOKER INCOME2 HS ADHY2_ NHW ;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

SAS Studio is an interface. It does not tell me what version of SAS you are using by running

%put SYSVLONG = &SYSVLONG;

The examples you posted do not use the AT= option. Please post the code that is giving the error, along with the portion of the SAS log that shows the error messages.