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!
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;
...
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;
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.
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;
...
Thank you guys!
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.
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.
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.