BookmarkSubscribeRSS Feed
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Hi,

 

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?

 

Dummy Data:

 

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 

 


Reg Plot.png
19 REPLIES 19
Reeza
Super User

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. 

sfo
Quartz | Level 8 sfo
Quartz | Level 8
Thanks,

I am trying to create the confidence bands and predictive limits bands using the symbol I= RLCLM but it's not coming like the one produced by proc reg.

So, was wondering if the colors can be changed in this plot only.
Reeza
Super User

Maybe see this example:

http://support.sas.com/documentation/cdl/en/grstatproc/67909/HTML/default/viewer.htm#n1gbe4z3i5l8hin...

 

SG Procs offer a lot of options for customization. 

sfo
Quartz | Level 8 sfo
Quartz | Level 8
Do you know how can we color code the circles for different groups in this example?
sfo
Quartz | Level 8 sfo
Quartz | Level 8
Do you know how can we color code the circles for different groups in this example?
Reeza
Super User

You haven't specified a SAS version, I'm assuming 9.4 

The Procs have changed a lot in the last versions. 

sfo
Quartz | Level 8 sfo
Quartz | Level 8
Thanks will have a look.

My SAS version is 9.2.

Rick_SAS
SAS Super FREQ

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.

 

 

sfo
Quartz | Level 8 sfo
Quartz | Level 8
Thanks I did some work around and was able to get this plots. But getting
stuck in assigning different symbols for example, triangle for Normal,
circle for moderate and square for mild. Is there a quick fix?

[image: Inline image 1]

##- Please type your reply above this line. Simple formatting, no
attachments. -##
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Thanks I did some work around and was able to get this plots. But getting stuck in assigning different symbols for example, triangle for Normal, circle for moderate and square for mild. Is there a quick fix?

 

 


Plot.PNG
Reeza
Super User

That depends. You should post your code, otherwise we don't know if you used GPLOT or SGPLOT or GTL or modified the template...

sfo
Quartz | Level 8 sfo
Quartz | Level 8

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";
run;

Reeza
Super User

Have you tried the symbol option on markerattrs?

SAS Innovate 2025: Save the Date

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

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 3064 views
  • 0 likes
  • 4 in conversation