BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RKC1
Calcite | Level 5

 

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;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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;

View solution in original post

4 REPLIES 4
DanH_sas
SAS Super FREQ

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

RKC1
Calcite | Level 5

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.

 

DanH_sas
SAS Super FREQ

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;
Reeza
Super User

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: Register Now

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!

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
  • 4 replies
  • 9113 views
  • 7 likes
  • 3 in conversation