Data visualization with SAS programming

PROC SGPLOT: Change Symbol for Grouped Data

Accepted Solution Solved
Reply
Contributor
Posts: 62
Accepted Solution

PROC SGPLOT: Change Symbol for Grouped Data

Hello All,

How can symbols of "grouped" data be changed in SCATTER statement in PROC SGPLOT?

      SCATTER X=VISN Y=VAR_MEAN /

            GROUP=TRTGR 

            GROUPDISPLAY=CLUSTER

            CLUSTERWIDTH=0.2 

            ERRORBARATTRS=( THICKNESS = 2)

            MARKERATTRS=(SYMBOL=  XXXXX);


the symbol=xxxx can be changed the same for all data. but what I'm asking is to have a different symbol for each of the TRTGR group..


Thanks for help!


Accepted Solutions
Solution
‎09-24-2013 06:52 PM
Occasional Contributor
Posts: 11

Re: PROC SGPLOT: Change Symbol for Grouped Data

You need to use attrmap to get different symbols/colors.

data attrmap;

  input id $ 

        value $ 5-10

        @12 fillcolor $8.1

        @21 markercolor $8.

        @30 markersymbol $6.;

  datalines;

trt trtgr1 CXDE6D00 CXDE6D00 circle

trt trtgr2 CX00537F CX00537F square

;

run;

proc sgplot data = xxx dattrmap = attrmap;

...

View solution in original post


All Replies
Super Contributor
Posts: 252

Re: PROC SGPLOT: Change Symbol for Grouped Data

MARKERCHAR might be what you're looking for.  For example:

data sale;
set sashelp.prdsale;
marker_var = substr(vvalue(month),1,1);
run;


proc sgplot data=sale;
scatter x=actual y=predict/
     group=month groupdisplay=cluster clusterwidth=0.2
     MARKERCHAR=marker_var;
run;
Super User
Posts: 11,134

Re: PROC SGPLOT: Change Symbol for Grouped Data

There may be options in latter versions but I have SAS 9.2. One way is to make a custom style and set the MarkerSymbol attribute in the GraphData1 through GraphDatan sections. If you need more more markers than the dozen or so GraphData sections, I'm clueless.

Solution
‎09-24-2013 06:52 PM
Occasional Contributor
Posts: 11

Re: PROC SGPLOT: Change Symbol for Grouped Data

You need to use attrmap to get different symbols/colors.

data attrmap;

  input id $ 

        value $ 5-10

        @12 fillcolor $8.1

        @21 markercolor $8.

        @30 markersymbol $6.;

  datalines;

trt trtgr1 CXDE6D00 CXDE6D00 circle

trt trtgr2 CX00537F CX00537F square

;

run;

proc sgplot data = xxx dattrmap = attrmap;

...

Contributor
Posts: 62

Re: PROC SGPLOT: Change Symbol for Grouped Data

Thank you guys!

SAS Super FREQ
Posts: 3,630

Re: PROC SGPLOT: Change Symbol for Grouped Data

For details and an example of using data attributes, see Specify the colors of groups in SAS statistical graphics - The DO Loop

The example uses colors, but symbols are handled the same way.

🔒 This topic is solved and locked.

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

Discussion stats
  • 5 replies
  • 5783 views
  • 2 likes
  • 5 in conversation