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.
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!
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.
Ready to level-up your skills? Choose your own adventure.