10-26-2015 03:28 PM
I'm familiar with converting RBG to Hex colors via the %colormac macro.
Here is the code I use to output the appropriate SAS colors. However, when I graph them it is clear it is not the correct colors. They are supposed to vary from yellow to red for the first six colors, and the last color is a standard grey. However, in some cases, the same color is output for multiple inputs (yellow and grey in this example). Is it possible to use exactly these colors in SAS?
%put %rgb (225, 210, 130) ; *this is a yellow;
%put %rgb(253,185,39); *this is a darker yellow;
%put %rgb(225,130,37); *this is a light orange;
%put %rgb(202, 82, 32); *this is a deeper orange;
%put %rgb(181, 18, 27); *this is a light-medium red;
%put %rgb(141, 27, 29); *this is a deeper red;
%put %rgb(191, 191, 191); *this is grey;
For grey and the first yellow, it outputs CXFFFFFF for both, which makes me wonder about the possible RGB color range.
Can these exact colors be used?
10-26-2015 03:45 PM
Thanks Paige. SAS needs 0-100 set of RGB.
Both the 0-100 and 0-255 sets of sRGB data represent the same sRGB standard. Notation in the 0-100 scale simply uses percentages of the 0-255 scale.
sRGB 0-255: 237-233-140.
To calculate the 0-100 value, simply use the absolute value of the decimal equivalent of the percentage of 255 contained in the 0-255 value, as follows:
R 237 = 237/255 = .929 rounded to .93; Absolute value of .93 = 93
G 235 = 237/255 = .909 rounded to .91; Absolute value of .91 = 91
B 140 = 140/255 = .549 rounded to .55; Absolute value of .55 = 55.
The resulting 0-100 value is 93-91-55.
We hope that you find this explanation helpful.
Need further help from the community? Please ask a new question.