Not too long ago I had a report generation request from an Alaska state agency. The request had some very specific requirements that detailed the use of user defined colors (by name), data driven control of the report, and Excel delivery using ODS and PROC REPORT. Along the way I had to: determine what colors are known to SAS by name; develop a user tool for color selection that would feed uniformly into a data driven table; construct formats based on the data that would match the user selected colors to specific types of report cells; and deliver the report using Excel. The process was interesting enough that it has resulted in two papers, which I will present at WUSS, September 7-9 in San Francisco.
In these two papers the process for discovering how to name, select, and display the colors is described. Formats are built from the color names and the reported data (DATA steps with two SET statements are used to perform a data merge). Traffic lighting is used is used at the cell level in PROC REPORT, and the whole process is driven by macros. Talk about a fun project! For those of you unable to join me in San Francisco for the full talk, here are two quick tips on how to do this.
Extracting color names from the SAS Registry
The names of available colors are stored in the SAS Registry. They can be extracted to a file through the use of PROC REGISTRY. The following REGISTRY step writes the list of color names and their HEX definitions to the text file COLORNAMES.TXT.
proc registry export= "colornames.txt" usesashelp startat='COLORNAMES'; run; |
Displaying a list of colors
If a list of color names is stored in a SAS data set, those colors can be displayed using PROC REPORT. In the following REPORT step, an Excel spreadsheet is created that shows the list of available colors that are stored in WORK.COLORS both with and without the color in the cell background.
proc report data=work.colors; column colorname colorname=clr; define colorname/ 'Color Name'; define clr / 'Color'; compute clr /char length=35; call define(_col_,'style','style={background='||colorname||'}'); endcomp; run; |
I hope you enjoyed these tips. Please join me for the complete talk at the Western Users of SAS Software Educational Forum and Conference, September 7-9 at the Grand Hyatt on Union Square in San Francisco. Discounted registration is still available through August 8th! Register now. It’s a great three days of educational opportunities, 100+ presentations, classes, workshops, networking and more.
Visit wuss.org for more information.
Editor's note: If you can't attend WUSS 2016 but would like to view Art's paper in it's entirety, the conference has plans to publish conference proceedings after the event.
1 Comment
I am getting the following message when run PROC MIXED. Please help.
Thanks,
WARNING: Output 'Ttests' was not created. Make sure that the output object name, label, or path
is spelled correctly. Also, verify that the appropriate procedure options are used to
produce the requested output object. For example, verify that the NOPRINT option is not
used.