Turn on suggestions

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

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- SAS Proc Reg plots overlay problem

Options

- 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 06-26-2019 02:00 PM
(1082 views)

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

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

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.

4 REPLIES 4

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

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;
```

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

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;

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;

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

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.

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

Perfect, thanks!

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

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.