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