Hello,
I have the following syntax:
proc gplot data=DM_Work.All_Rates;
plot ir*time=testrx / vaxis = axis1 haxis=axis2
legend=legend1;
run;
I would like to specify the colour for the grouping variable TestRX. TestRX groups treated v untreated. I am not sure how to make one line blue and one line red.
Any help with the syntax would be greatly appreciated.
Hi do you know if It is possible to combine my proc template and the macro ?
proc template;
define style myfont;
parent=styles.default;
style GraphFonts /
'GraphFootnoteFont' = ("Arial",10pt,bold)
'GraphTitleFont' = ("Arial",6pt,bold)
'GraphValueFont' = ("Arial",8pt)
'GraphAnnoFont' =("Arial", 10pt)
'GraphUnicodeFont'=("Arial", 10pt)
'GraphLabelFont'=("Arial", 10pt)
'GraphDataFont'=("Arial", 10pt);
end;
run;
and
%modstyle(
parent=statistical,
name=plotmod,
type=CLM,
colors=red blue,
fillcolors=colors,
markers=triangefilled circlefilled
);
Move over to using proc sgplot and proc template, they will give you more controll over your output:
35864 - Change line colors and styles for PROC SGPLOT output
If you want to continue to use GPLOT then the statement that provides control over lines and markers is SYMBOL.
Symbol1 color=red I=join;
symbol2 color=blue I=join;
Place these before the gplot statement.
The first value of TestRX encountered will get the characteristics set in the first symbol statement.
Hi I decided et go with Sgplot and use the code below:
proc sgplot data=DM_Work.All_Rates; |
series x=TIME y=IR / group=TestRx markers lineattrs=(pattern=solid ) ;
REFLINE 1 2 3 4 ;
XAXIS TYPE = DISCRETE; | ||
yaxis label = 'AMI Rate per 1000' ; |
xaxis label = 'Time in Days ' grid values = (-360 to 360 by 30);
run
However I want to change the markers so they are filled triangle and filled Circle. How do I do this when using the group = option ?
Many thanks in advance.
Lucy
Hi Lucy, what version of SAS have you got?
Thanks.
9.2.
I am also trying to figure out how to get minor tick marks on the horizontal axis and rotate the label on the vertical access.
Many thanks in advance, SAS graph is new to me
Your best bet is to have a look through Sanjay's blog at:
http://blogs.sas.com/content/graphicallyspeaking/
He has working examples for most versions of pretty much everything graph wise. Its better than the documentation.
Because you have SAS 9.2, I would use the %modstyle macro to change your markers. Such as this below:
%modstyle(
parent=statistical,
name=plotmod,
type=CLM,
colors=red blue,
fillcolors=colors,
markers=triangefilled circlefilled
);
You can then call the updated template by using ods listling style = plotmod; (or even ods html style = plotmod;) before your Proc SGPLOT.
For documentation on the %modstyle macro go to here:
I thought the tickmarks and ticklabels would automatically be in the format you wanted them?
great thank you for your help. I wanted to use minor tickmarks on the horizontal axis and offset the graoh slighty on the left so there was some space between the graph and the border but I am unsure how to do this. In terms of the label on the vertical axess i would like to rotate it 90 degrees but again am unsure of the syntax.I will take a look at the blog mentioned above to see if I can find the answer. thank you again for all your help.
Hi do you know if It is possible to combine my proc template and the macro ?
proc template;
define style myfont;
parent=styles.default;
style GraphFonts /
'GraphFootnoteFont' = ("Arial",10pt,bold)
'GraphTitleFont' = ("Arial",6pt,bold)
'GraphValueFont' = ("Arial",8pt)
'GraphAnnoFont' =("Arial", 10pt)
'GraphUnicodeFont'=("Arial", 10pt)
'GraphLabelFont'=("Arial", 10pt)
'GraphDataFont'=("Arial", 10pt);
end;
run;
and
%modstyle(
parent=statistical,
name=plotmod,
type=CLM,
colors=red blue,
fillcolors=colors,
markers=triangefilled circlefilled
);
Hi Lucy,
Yes you can combine the proc template and the %modstyle macro by using parent=myfont in the %modstyle macro, which will reference the template that you have created instead of the STATISTICAL style.
Okay yes, I will try to look at your other questions later if you haven't found a solution by then.
Thanks.
PS you could have also changed the colours of your groups solely by using Proc Template too.
great thank you.
That's fine. Can you please mark some of the responses to your questions as Correct Answers or Helpful Answers were appropriate?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.