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
- /
- Changing Colors on a Standard Output FitPlot from ...

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-08-2016 05:13 PM

I like the graphs output at baseline from the proc reg command for linear regression:

ods graphics on;

**proc** **reg** DATA=good;

MODEL mv_glob_ap_diam=BSA/ stb clb;

OUTPUT OUT=OUTREG1 P=PREDICT R=RESID RSTUDENT=RSTUDENT COOKD=COOKD

run;**quit**;

ods graphics off;

Example here:

I created many of these graphs for a figure of a paper, but the journal would like more color to differentiate them. As such I would like to change the points, and possibly the lines and shading to different colors. Because this is a SAS standard output I am unsure how to do this.

I have tried GOPTIONS prior to the command, but they are trumped by the PROCREG default options. Specifically I set CPATTERN and CSYMBOL to a Yellow prior to the reg procedure.

Then I tried to recreate the plot in a more basic way using the plot command and conf, and it contains the correct information but I will need to define all the different parameters that make up the graph, x, y spacing, coloring, etc.

ods graphics on;

**proc** **reg** DATA=good;

MODEL mv_glob_ap_diam=BSA/ stb clb;

Goptions Csymbol=Red Cpattern=Red;

plot mv_glob_ap_diam*BSA /conf;

**run**;**quit**;

ods graphics off;

I can try to figure this out, but am unsure to make the 95% confidence interval area shade as opposed to be a line etc, and like the more basic X and Y tick marks and scales in the Fit Plot.

Ideally I could use the standard output, but just tell it to use a different color than blue. Is there a simple way to do that more globally, or do I need to specify plot and individually define everything to recreate the fit plot I like?

Is there an example of the underlying fitplot code that I can edit instead of trial and error from scratch?

Thank you in advance.

Accepted Solutions

Solution

12-08-2016
05:44 PM

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

Posted in reply to snoopy369

12-08-2016 05:42 PM

Thank you VERY much.

I basically want to be able to change the color of the data points, and the shading of the 95% confidence interval between the limit lines, as well as the actual fit line, but leave the rest of the appearance in the "fit plot" the same.

I will play with this. I really appreciate it. i have to remake ~ 10 graphs and this helps me for the future as well.

All Replies

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

Posted in reply to cakemonster

12-08-2016 05:27 PM - edited 12-08-2016 05:30 PM

You can get effectively the same graph using the REG statement in SGPLOT. Then you have tons of control.

It's unclear exactly _what_ you want to control, so I'll just change a few things arbitrarily here.

Here are two examples: the original one almost identical to yours, and one where I changed almost everything.

```
title "Original";
proc sgplot data=sashelp.class;
reg x=height y=weight / CLM CLI;
run;
title "Modified version";
proc sgplot data=sashelp.class;
reg x=height y=weight / CLM CLI lineattrs=(color=green) markerattrs=(color=red)
clmattrs=(clmfillattrs=(color=blue)) cliattrs=(clilineattrs=(color=orange))
;
run;
```

versus

Solution

12-08-2016
05:44 PM

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

Posted in reply to snoopy369

12-08-2016 05:42 PM

Thank you VERY much.

I basically want to be able to change the color of the data points, and the shading of the 95% confidence interval between the limit lines, as well as the actual fit line, but leave the rest of the appearance in the "fit plot" the same.

I will play with this. I really appreciate it. i have to remake ~ 10 graphs and this helps me for the future as well.

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

Posted in reply to snoopy369

12-08-2016 05:51 PM

Can you show me how to make the lines bordering the confidence interval "broken" or dashed as they are in the original image.

Thank You.

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

Posted in reply to cakemonster

12-08-2016 05:53 PM

Using snoopy's example:

`cliattrs=(clilineattrs=(color=orange pattern=dash))`

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

Posted in reply to cakemonster

12-08-2016 05:29 PM

Since your just tweaking the appearance for journal submission (as opposed to applying the change in a batch run), your best option is to probably use the ODS Graphics editor. On the ODS destination statement (HTML, in the case), add SGE=on to the statement:

ods html sge=on;;

ods graphics on;

**proc** **reg** DATA=good;

MODEL mv_glob_ap_diam=BSA/ stb clb;

OUTPUT OUT=OUTREG1 P=PREDICT R=RESID RSTUDENT=RSTUDENT COOKD=COOKD

run;**quit**;

ods graphics off;

You should see an addition node appear in the results viewer. Double-click on it, and the editor will appear with your graph. It is a "live" graph, so you can do things like:

- Change plot attributes
- Move legends around
- Edit titles/footnote/axis label
- Annotate the graph

You cannot edit the data, though (that is by design). Give that try and see if it does everything you need.

Thanks!

Dan

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

Posted in reply to DanH_sas

12-08-2016 05:43 PM

I will try this as well. Thank you.

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

Posted in reply to cakemonster

12-08-2016 05:35 PM

The other option you have, by the way, if you're preferring to stay within PROC REG, is to change the styles in your current style template. This is covered in great detail here: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_odsgraph_se...

This is the "new" way to do what you were trying to do with GOPTIONS, which I don't think has any effect on ODS GRAPHICS but only works on old-style graphics.

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

Posted in reply to snoopy369

12-08-2016 05:44 PM

Thank you.