08-30-2016 07:35 PM
Is there a way to customize the standard plots that are produced using PROC REG ? For example, is there a way I can color code ( on the basis of group), enlarged the circles or change the shape of the symbol in this fit plot?
Group Xaxis Yaxis
1 10 5
1 20 10
1 30 15
2 40 20
2 50 25
3 60 30
3 70 35
3 80 40
08-30-2016 08:18 PM
Yes, but not easily.
It's done via modifying the graph template.
Warren Kuhfeld has a few papers as well as a video that details the steps.
The other option is to get the raw data and create the plot manually using either SGPLOT or GTL.
08-30-2016 08:27 PM
08-30-2016 08:36 PM
Maybe see this example:
SG Procs offer a lot of options for customization.
08-30-2016 10:09 PM
An attribute map is the easiest way.
Full write up:
08-31-2016 05:42 AM - edited 08-31-2016 11:00 AM
Three ways, depending on your needs and programming experience. A nice overview is the paper by Rodriguez.
1. ODS Graphics Editor for tiny changes (titles, lines,...)
2. Use the OUTPUT statement to generate the data you want, then use PROC SGPLOT to create the graph with the attributes you want.
3. Create an ODS style or modify the templates. See "ODS Graphics" chapter in the SAS/STAT documentation.
Personally, I recommend (2) for your needs, since it sounds like you don't have much experience with ODS styles or templates. There are many papers that introduce SG procedures like SGPLOT. Here's an introductory paper on SG procedures that I encountered recently.
08-31-2016 01:29 PM
08-31-2016 01:31 PM
08-31-2016 02:01 PM - edited 08-31-2016 02:03 PM
Thanks below is the code. I have SAS 9.2
proc sgplot data=plot_data ;
reg x=&xaxis y=&yaxis / CLM CLI markerattrs=(color=white) name="reglegend";
inset "R-Squared: %cmpres(&rsq_3sig)" /noborder ;
scatter x=&xaxis y=&yaxis/ group = cohort_no markerattrs=(symbol=circlefilled size=10px) name="scatterlegend" ;
footnote height=1 justify=center "P-Value: %cmpres(&pvalue)" ;
keylegend "reglegend" / position = bottom location = outside;
keylegend "scatterlegend"/ position = topright location = inside down=3 noborder ;
&xaxis = "&xlabel";