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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 8157 views
  • 7 likes
  • 3 in conversation