Hi,
I need to have different marker symbols for each color (circlefilled starfilled triangle). Right now I am getting only 'circlefilled' for all colors. Could any one help me how we can get different symbols for different colours? Thanks .
I tried using markerattrs=(symbol=(circlefilled starfilled triangle ) ). But did not work .
Code:
proc sgplot data=chg noborder ;
styleattrs datacontrastcolors=(green gold red black blue grey pink) ;
refline 0 / lineattrs=(pattern=shortdash);
series x=xvar y=yvar / group=subjid grouplc=atrtgrp groupmc=atrtgrp
markers markerattrs=(symbol=circlefilled )
lineattrs=(thickness=2 pattern=solid) name='a';
keylegend 'a' / title='TRT' type=linecolor valueattrs=(size=7)
location=inside position=topright across=1 opaque;
xaxis label='Week';
run;
Oh, I see what you're doing. You need to remove the SYMBOL from MARKERATTRS and use DATAMARKERS on the STYLEATTRS statement. Like this:
proc sgplot data=chg noborder ;
styleattrs datacontrastcolors=(green gold red black blue grey pink)
datamarkers=(circlefilled starfilled triangle ) ;
refline 0 / lineattrs=(pattern=shortdash);
series x=xvar y=yvar / group=subjid grouplc=atrtgrp groupmc=atrtgrp
markers lineattrs=(thickness=2 pattern=solid) name='a';
keylegend 'a' / title='TRT' type=linecolor valueattrs=(size=7)
location=inside position=topright across=1 opaque;
xaxis label='Week';
run;
Your're probably generating HTML output, using the default HTMLBLUE style. The style has ATTRIORITY=COLOR set, which will give you that behavior. To override it, add this before you run your proc:
ods graphics / attrpriority=none;
Hope this helps!
Dan
Dear Dan,
No, I am creating pdf document, I have all graphics set. I am getting lines in different colour as I specified (datacontrastcolors=(green gold red black blue grey pink). But I want different marker symbols along with circlefiled. Hope you got it. Thanks.
Oh, I see what you're doing. You need to remove the SYMBOL from MARKERATTRS and use DATAMARKERS on the STYLEATTRS statement. Like this:
proc sgplot data=chg noborder ;
styleattrs datacontrastcolors=(green gold red black blue grey pink)
datamarkers=(circlefilled starfilled triangle ) ;
refline 0 / lineattrs=(pattern=shortdash);
series x=xvar y=yvar / group=subjid grouplc=atrtgrp groupmc=atrtgrp
markers lineattrs=(thickness=2 pattern=solid) name='a';
keylegend 'a' / title='TRT' type=linecolor valueattrs=(size=7)
location=inside position=topright across=1 opaque;
xaxis label='Week';
run;
It would helpful if you could either post data that we can test your code with rewrite it to use SASHELP.CARS
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.