## With Color Ramp: Define which value corresponds to neutral

Solved
Frequent Contributor
Posts: 84

# With Color Ramp: Define which value corresponds to neutral

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

Accepted Solutions
Solution
‎09-11-2016 10:33 PM
SAS Super FREQ
Posts: 978

## Re: With Color Ramp: Define which value corresponds to neutral

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;
``````

All Replies
Solution
‎09-11-2016 10:33 PM
SAS Super FREQ
Posts: 978

## Re: With Color Ramp: Define which value corresponds to neutral

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;
``````
Frequent Contributor
Posts: 84

## Re: With Color Ramp: Define which value corresponds to neutral

That's excellent. Thank-you!

☑ This topic is solved.