BookmarkSubscribeRSS Feed
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";
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 is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

Submit your idea!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2 in conversation