You did not specify the new style on the ODS RTF destination.
ods rtf style=markstyle file='C:\test1.rtf';
It does not matter if the name of the statement is "S" or "Toto", as long as you use the same name in the KeyLegend statement.
hi ... and for those of us still catching up (though this still seems easier to me than editing templates, most likely an issue of familiarity) ...
goptions reset=all ftext='calibri' htext=3 gunit=pct
dev=png xpixels=1024 ypixels=768 gsfname=gout;
symbol1 f="wingdings" v='6c'x h=3 c=blue i=join; /* circle */
symbol2 f="wingdings 3" v='70'x h=3 c=blue i=join; /* triangle */
symbol3 f="wingdings" v='75'x h=3 c=blue i=join; /* triangle */
axis1 label=('Temperature') order=0 to 3 by 0.5 minor=none offset=(3,3)pct;
axis2 label=(a=90 'Solcity') minor=none offset=(3,3)pct;
legend1 frame mode=share position=(top inside left)
label=('Treatment') shape=symbol(.00001,2.5)pct;
title1 ls=2;
title2 a=-90 ls=2;
filename gout 'z:\plot.png';
proc gplot data=test;
plot value*temp=trt / haxis=axis1 vaxis=axis2 legend=legend1;
run;
quit;
Do the following change :
scatter x = temp y = value / group=trt markerattrs=(size=9 color=black) name="Toto" ;
keylegend "Toto";
PG
Hi PG,
Many thanks for your suggestion!! Is there any particular reason to use 'Toto' instead of 's'?
When tried to output the plot as rtf, the symbols in the RTF output were not what I wanted. Instead of circle, triangle, and square specified by the program, the RTF output gave circle, +, and x. However the plot was made without ODS rtf output, the SGPLOT gave a right symbols. It seems that somehow %modstyle was affect by ODS. Could you please help on this? Thanks! John
(also refer the attached program)
The following program provides correct symbols.
%modstyle(name=markstyle, parent=statistical, type=CbyLbyM,
markers=circle triangle square)
ods listing style=markstyle;
proc sgplot data=test;
xaxis label='Temperature' ;
yaxis label="Solicity" ;
title "";
series x = temp y = value / group=trt lineattrs=(pattern=solid color=black thickness=1) ;
scatter x = temp y = value / group=trt yerrorlower=sdlo yerrorupper=sdhi markerattrs=(size=9 color=black) name='Toto';
keylegend 'Toto'/position=topright location=inside across=1;
run;
The following program, when add rtf output, fail to provide correct symbols.
ods graphics on/noborder ;
ods rtf file='C:\SAS\test1.rtf';
%modstyle(name=markstyle, parent=statistical, type=CbyLbyM,
markers=circle triangle square)
ods listing style=markstyle;
proc sgplot data=test;
xaxis label='Temperature' ;
yaxis label="Solicity" ;
title "";
series x = temp y = value / group=trt lineattrs=(pattern=solid color=black thickness=1) ;
scatter x = temp y = value / group=trt yerrorlower=sdlo yerrorupper=sdhi markerattrs=(size=9 color=black) name='Toto';
keylegend 'Toto'/position=topright location=inside across=1;
run;
ods rtf close;
MODSTYLE creates a new style that must be associated with your ODS destination, RTF. Try the following :
%modstyle(name=markstyle, parent=statistical, type=CbyLbyM,
markers=circle triangle square);
ods rtf file='C:\SAS\test1.rtf' style=markstyle;
ods graphics on/noborder;
Toto is just another name, like Foo or Bar, that programmers use to signal that any name can be used. Feel free to change it.
PG
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.