Data visualization with SAS programming

Code for color scheme in SAS graph

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 104
Accepted Solution

Code for color scheme in SAS graph

Hi All,

I created a graph in SAS with 6 subgroups that SAS color codes by default. I would like to use these specific colors in other graphs and so need to know the rgb color codes that SAS is using. I've looked at this link that shows all the color codes in SAS (TS-DOC: TS-688 - Defining Colors using Hex Values) but I can't find the exact matches. I think it would be easier to see what codes SAS is already using, as my team likes these colors and doesn't want to change them.

thanks,

S


Accepted Solutions
Solution
‎07-23-2013 12:41 PM
Super User
Posts: 19,105

Re: Code for color scheme in SAS graph

Figure out what template you're using then output it using proc template.

For example:

proc template;

source styles.default;

run;

Then check the log and look for lines that look like:

'gdata12' = cxDDD17E

      'gdata11' = cxB7AEF1

      'gdata10' = cx87C873

      'gdata9' = cxCF974B

      'gdata8' = cxCD7BA1

      'gdata6' = cxBABC5C

      'gdata7' = cx94BDE1

      'gdata4' = cxA9865B

      'gdata5' = cxB689CD

      'gdata3' = cx66A5A0

      'gdata2' = cxDE7E6F

      'gdata1' = cx7C95CA;

I don't know if it's the gdata or gcdata colours (think its gdata), but it also depends on what proc you're using. If you're using ramps colours it could be something else, but this is one way to find out.

OR you can go into EG style editor tool and try and grab them from there.


Good Luck Smiley Happy

View solution in original post


All Replies
Solution
‎07-23-2013 12:41 PM
Super User
Posts: 19,105

Re: Code for color scheme in SAS graph

Figure out what template you're using then output it using proc template.

For example:

proc template;

source styles.default;

run;

Then check the log and look for lines that look like:

'gdata12' = cxDDD17E

      'gdata11' = cxB7AEF1

      'gdata10' = cx87C873

      'gdata9' = cxCF974B

      'gdata8' = cxCD7BA1

      'gdata6' = cxBABC5C

      'gdata7' = cx94BDE1

      'gdata4' = cxA9865B

      'gdata5' = cxB689CD

      'gdata3' = cx66A5A0

      'gdata2' = cxDE7E6F

      'gdata1' = cx7C95CA;

I don't know if it's the gdata or gcdata colours (think its gdata), but it also depends on what proc you're using. If you're using ramps colours it could be something else, but this is one way to find out.

OR you can go into EG style editor tool and try and grab them from there.


Good Luck Smiley Happy

Frequent Contributor
Posts: 104

Re: Code for color scheme in SAS graph

Thanks Reeza! That was exactly what I was looking for.

SAS Employee
Posts: 980

Re: Code for color scheme in SAS graph

I installed a Windows tool called 'Pixeur' which lets me point my mouse at a color in a graph (or anywhere), and it tells me the RGB hex code for the color.  I find it *very* useful for determining the colors to hard-code, to replicate the colors that were used in another graph.

Frequent Contributor
Posts: 104

Re: Code for color scheme in SAS graph

That's a great idea, thanks Robert!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 568 views
  • 2 likes
  • 3 in conversation