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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
sunilpusarla
Fluorite | Level 6

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

5 REPLIES 5
snoopy369
Barite | Level 11

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

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.

sunilpusarla
Fluorite | Level 6

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;

...

Altal
Calcite | Level 5

Thank you guys!

Rick_SAS
SAS Super FREQ

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.

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
  • 5 replies
  • 10197 views
  • 2 likes
  • 5 in conversation