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!
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.
Add GROUP=DRUGUSE to the REG statement as well.
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.
@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?
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?
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.
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.
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."
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?
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);
That gives me the error "VARIABLE CONFIGURATION IS NOT CURRENTLY SUPPORTED BY THE EFFECTPLOT STATEMENT"
Please post your code and specify what version of SAS you are running.
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.