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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

15 REPLIES 15
DanH_sas
SAS Super FREQ

Add GROUP=DRUGUSE to the REG statement as well.

LGrau
Calcite | Level 5

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.

 

 

ballardw
Super User

@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?

WarrenKuhfeld
Rhodochrosite | Level 12

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?

LGrau
Calcite | Level 5
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;
 
 
WarrenKuhfeld
Rhodochrosite | Level 12

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.

 

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_introcom_sec...

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_introcom_sec...

WarrenKuhfeld
Rhodochrosite | Level 12
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.

Rick_SAS
SAS Super FREQ

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."

LGrau
Calcite | Level 5

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?

Rick_SAS
SAS Super FREQ

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);
LGrau
Calcite | Level 5

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

Rick_SAS
SAS Super FREQ

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

LGrau
Calcite | Level 5

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;

 

 

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 15 replies
  • 2547 views
  • 7 likes
  • 5 in conversation