How can I change the bar color based upon the value of rate1?
For example, if rate1=>2 I would like the bar to be red and if 0<2 then I would like the bar to be yellow.
proc gchart data=goals;
I would do this by copying rate1 to a new column (we'll say rate2) and put a user-defined format on rate using your range specifications. Then, specify two PATTERN statements with the colors you want (yellow first, then red). Sort your data by rate2 from least to greatest. Set rate2 as the SUBGROUP variable on your VBAR statement. Hopefully, that will give you the result you want.
Unfortunately, gchart does not let you directly specify specific colors for specific values or ranges of values (you could do that in SAS/AF charts with the "color range object", but not in SAS/Graph charts).
The easiest way I know of to do that, is to add an extra variable to your data set, and use if/else statements to assign a value to that variable using if/else statements based on the >= rules you mentioned.
Then in the gchart, use the subgroup= option, and specify that new variable. The values of this variable will get mapped to the colors in the pattern statement (you have to get a little 'tricky' if your data does not always contain obsns for all the desired colors, by the way).
Here is an example, showing the basics:
input bu rate1;
data goals; set goals;
if rate1>=2 then colorval=1;