BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mduarte
Quartz | Level 8

Hi, 

 

I would like to define which value corresponds to neutral in the colour ramp for a bubble chart.  Does anyone know how I could achieve this?  E.g. For the following sample code, assume I wish to make weight 80 to be neutral colour (i.e. white)... 

Note that in some instances the colour variable the desired neutral colour value will be less than the midpoint, an in others greater than the midpoint.

 

proc sgplot data=sashelp.class;
bubble x=age y=height size=age / bradiusmin=0 
transparency=0.5 colorresponse=weight
colormodel=(blue white red);
run;

All help much appreciated

Thanks,

Marie

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The best way to do that is to use a range attrmap. If you need to change the neutral value, you can do it in the data step.

 

data attrmap;
retain id "myid";
input min $ 1-5 max $ 7-11 excludemin $ 13-17 excludemax $ 19-23 colormodel1 $ 25-29 colormodel2 $ 31-35;
cards;
_min_ 80    false true  blue  white
80    _max_ false false white red
;
run;

proc sgplot data=sashelp.class rattrmap=attrmap;
bubble x=age y=height size=age / bradiusmin=0
transparency=0.5 colorresponse=weight rattrid=myid;
run;

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

The best way to do that is to use a range attrmap. If you need to change the neutral value, you can do it in the data step.

 

data attrmap;
retain id "myid";
input min $ 1-5 max $ 7-11 excludemin $ 13-17 excludemax $ 19-23 colormodel1 $ 25-29 colormodel2 $ 31-35;
cards;
_min_ 80    false true  blue  white
80    _max_ false false white red
;
run;

proc sgplot data=sashelp.class rattrmap=attrmap;
bubble x=age y=height size=age / bradiusmin=0
transparency=0.5 colorresponse=weight rattrid=myid;
run;
mduarte
Quartz | Level 8

That's excellent. Thank-you!

sas-innovate-2024.png

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.

 

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
  • 2 replies
  • 1143 views
  • 1 like
  • 2 in conversation