My question involves colors definition in a proc template for producting a clustered bars chart.
Bars represent products while clusters represent years: each product has its own color and the graph shows the sales of some products across several years.
In the past, I used HEX colors coding for several SAS graphs using proc sgplot with excellent results.
Some examples of HEX color coding used in the past are: "#C95117" (red) or "#FAD500" (yellow).
When I tried to use the hex color coding scheme in proc template I received an error message,
while using the SAS color scheme the procedure runs fine.
The client has a company color coding and wants the graphs to be aligned with that, so here is my question:
which color coding should be used with proc template: SAS , HEX, RGB or others?
Also, in the proc template I defined colors in the following way:
proc template ...;
begingraph/ datacolors=(green yellow red) datacontrastcolors=(green yellow red);
Is there another way to define colors used by a bar chart in proc template?
SAS will accept several different color schemes and the method for the codes varies by the prefix as well as the color scheme. I haven't run into an instance where mixing the schemes in a single use causes problems as long as the code is correct.
From the documentation:
Overview of Color-Naming SchemesThe valid color-naming schemes in SAS are as follows:Examples of SAS Color-Naming Schemes shows examples of each color-naming scheme.
Examples of SAS Color-Naming Schemes Color-Naming Scheme Example RGB COLORS=(CX98FB98 CXDDA0DD CXFFDAB9 CXDB7093 CXB0E0E6) RGBA COLORS=(A98FB9833 ADDA0DD66 AFFDAB999 ADB7093CC AB0E0E6FF)Note: The RGBA color mode is not supported by Java devices. The RGBA color mode is supported by ActiveX devices when the output is used in Microsoft applications. CMYK COLORS=("FF00FF00" "00FFFF00" "FFFFFF00") HLS COLORS=(H14055FF H0F060FF H0B485FF H07880FF) HSV COLORS=(V0F055FF V010FFFF V03BFFFF V12C55E8) Gray Scale COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3) SAS Registry Colors COLORS=(palegreen plum peachpuff palevioletred powderblue) CNS Color Names COLORS=("very light purplish blue" "light vivid green" "medium strong yellow" "dark grayish green")
Also if you have the value of one scheme and need the equivalent in another SAS provides some macros to help if you have SAS/Graph:
conversions that are possible using these macros.
From Color Value To Color Value Conversion Macro CMY RGB %CMY CNS HLS %CNS RGB HLS %RGB2HLS HLS RGB %HLS2RGB
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.