BookmarkSubscribeRSS Feed
linlin87
Quartz | Level 8

Hi SAS Comm,

I have scatter plot in SGPLOT very simple. It has group statement (animal). This take two value: "hamster" and "gerbil". However when I plot the group=Gerbil data is plotted underneath the group=Hamster data, so I can't see it (the Hamster data is more dense, so all gerbil data underneath). How do I change the ordering, to bring the gerbil data to the front. I do not want to change it to "01: Hamster" and "02: Gerbil". I have tried sorting descending, it no working.

Help would be appreciate!
 

ods graphics / width=4.5in height=4.5in noborder attrpriority=none;
proc sgplot data=table2 ;styleattrs datacontrastcolors=(blue red)
datasymbols=(squarefilled circlefilled);
scatter x=weight y=age / group=animal markerattrs=(size=3pt);
xaxis grid max=0 min=50 label="Weight in grams";
yaxis grid max=0 min=20 label="Age in weeks";
run;
1 REPLY 1
PaigeMiller
Diamond | Level 26

Try this

 

scatter x=weight y=age / group=animal markerattrs=(size=3pt) grouporder=descending;

 

You can also add a transparency option so that the markers on top don't completely hide the markers underneath. You might also want to make the markers smaller.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 445 views
  • 0 likes
  • 2 in conversation