Data visualization with SAS programming

Multiple marker symbols in proc sgplot

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Multiple marker symbols in proc sgplot

 

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;


Accepted Solutions
Solution
‎03-22-2018 05:13 PM
SAS Super FREQ
Posts: 1,047

Re: Multiple marker symbols in proc sgplot

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


All Replies
SAS Super FREQ
Posts: 1,047

Re: Multiple marker symbols in proc sgplot

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

New Contributor
Posts: 2

Re: Multiple marker symbols in proc sgplot

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.

 

Solution
‎03-22-2018 05:13 PM
SAS Super FREQ
Posts: 1,047

Re: Multiple marker symbols in proc sgplot

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;
Super User
Posts: 22,857

Re: Multiple marker symbols in proc sgplot

It would helpful if you could either post data that we can test your code with rewrite it to use SASHELP.CARS

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 119 views
  • 2 likes
  • 3 in conversation