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

Hey Folks,

 

I am running a SAS Proc Reg procedure and producing prediction plots using the Plots syntax. I have a control and 3 treatment levels that I would like to overlay each regression and their respective CLM CLI. I can get the plots separately fine but when I use overlay it builds  CLM CLI around all the regression lines not each individually. How can I correct this?  Pgm below, plots attached.  

 

proc sort data=MeanTotTRlat; by treatment;

proc reg data=MeanTotTRlat plots=predictions (x=LatR );
var LatR2;
model TotTR = LatR LatR2;by treatment;
plot overlay;
run;quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I apologize for not answering that portion of your question.

 

First, a confession: I simplified the call by using PLOTS=FITPLOT, which is sort of a generic specification. The actual name of the plot you are creating is the ANCOVAPLOT, as stated in the documentation for the PLOTS= option

 

To get only CLM, use PLOTS=ANCOVAPLOT(CLM)

To get only CLI, use PLOTS=ANCOVAPLOT(CLI)

Because you want both, you can use

proc glm data=MeanTotTRlat plots=ancovaplot(limits);

 

Be aware that the four lines with confidence bands might overlap and the graph might look crowded.

 

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

A few thoughts:

1. SAS introduced ODS statistical graphics way back in version 8, so you should upgrade to ODS. The newer graphs have many advantages over the older graphs.

2. There is a difference between BY-group analysis by treatment and using treatment as a CLASS variable. If you put Treatment on a  CLASS statement, the overlay will happen automatically. As a bonus, you can compare the treatment effects in the statistical output.

3. You can switch from PROC REG to PROC GLM to solve two problems: (A) PROC GLM enables you to use the quadratic variable LatR*LatR directly without having to create it in a DATA step, and (B) PROC GLM supports the CLASS statement.

 

Putting these all together, the following statements provide what you want 

 

ods graphics on;
proc glm data=MeanTotTRlat plots=FitPlot;
class treatment;
model TotTR = latR LatR*LatR treatment;
run;
BDORR
Fluorite | Level 6
Rick,

Thanks for the reply. A more elegant solution for sure for the issue I had (your code below). I get all four regression lines on my graph. However, I still don't get the CLM on my regression lines. Even when I use the Plots=INTPLOT(CLM) option.

Any Suggestions?

proc glm data=MeanTotTRlat plots=fitplot;
class treatment;
model TotTR = latR LatR*LatR treatment;
run;

Rick_SAS
SAS Super FREQ

I apologize for not answering that portion of your question.

 

First, a confession: I simplified the call by using PLOTS=FITPLOT, which is sort of a generic specification. The actual name of the plot you are creating is the ANCOVAPLOT, as stated in the documentation for the PLOTS= option

 

To get only CLM, use PLOTS=ANCOVAPLOT(CLM)

To get only CLI, use PLOTS=ANCOVAPLOT(CLI)

Because you want both, you can use

proc glm data=MeanTotTRlat plots=ancovaplot(limits);

 

Be aware that the four lines with confidence bands might overlap and the graph might look crowded.

 

BDORR
Fluorite | Level 6

Perfect, thanks!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

Discussion stats
  • 4 replies
  • 1243 views
  • 3 likes
  • 2 in conversation