BookmarkSubscribeRSS Feed
wernie
Quartz | Level 8

I have multiple states that I'm trying to plot suppression and stability for using different thresholds on one plot. I've already plotted suppression and stability for different states (represented by different symbols) using a macro to generate the scatterplots for the different thresholds separately (general code is below).

 


proc sgplot data=all_states_stats;
    scatter x=Perc_unstable y=Perc_supp / group=state;
    xaxis label = 'Percent unstable';
    yaxis label = 'Percent suppressed';
    where threshold=&threshold;
run;

 

However, I want to try to put everything on the same plot where the symbol represents the state and the colour represents the threshold. I've tried removing my where statement and adding a second group= (group=threshold) statement, but that only plots everything giving all states different colours, but no way to show which point is which threshold.

 


proc sgplot data=all_states_stats;
    scatter x=Perc_unstable y=Perc_supp / group=state group=threshold;
    xaxis label = 'Percent unstable';
    yaxis label = 'Percent suppressed';
run;

 

Any help is appreciated. Thank you!

3 REPLIES 3
jimhorne
Obsidian | Level 7

It sounds as if you may want to explore SGPANEL.  It wouldn't give you everything on a single plot but it would give you everything grouped together.

PaigeMiller
Diamond | Level 26

In PROC SGPLOT, you can create attribute maps so that each state/threshold combination is assigned a specific color and symbol.

 

http://documentation.sas.com/?docsetId=grstatproc&docsetTarget=n18szqcwir8q2nn10od9hhdh2ksj.htm&docs...

 

Of course, if you have 50 states and a dozen or two dozen thresholds, a scatterplot probably would lose visual information, as no one could visually process 50 different colors and two dozen markers. There is a limit to how many color/symbol combinations can be perceived by a viewer.

--
Paige Miller
Jay54
Meteorite | Level 14

What you need is the ability to group separately by two classifiers, one for marker symbol, one for marker color.  This is NOT supported for SCATTER plot, but IS supported in SERIES plot.  You can use SERIES plot with markers and set line thickness=0.  Then, you can use the GROUP, GROUPMC and GROUPMS to control the marker color and symbols separately.  Remember to use a Style with Attrpriority=none, or set Attrpriority=none in the ODs Graphics statement to see the different marker symbols.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 4307 views
  • 0 likes
  • 4 in conversation