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
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.