I have the following example output table, where 1,2,3,4 are columns for:1) total sales 2012 2) % of total regions 3)Total sales for 2011 and 4) % for total region
this is created by grouping different regions for the company. I would like to create a single cell trafficlight with Proc tabulate. that will affect the column 2012 percentage only for the North region as shown below. (I have the format done, I just need to know how to single specify North and the value of the single % representation). If possible, I would like to keep using pro Tabulate and not proc Report.
North |
|
South |
|
East |
|
West |
|
NorthE |
|
SouthE |
|
Total |
|
An example of your color background format name and the table statement used to create the table will be helpful to provide specific advise.
BTW, why did you set tag for enterprise guide, gchart and functions when this question doesn't relate to any of those topics?
Sorry for the tags. Newbee with my first three questions to this user community.
The project is all done whithin EG, user generates graphs and charts exported to SAS BI.
Here is my code for the format and the proc tabulate
PROC FORMAT
;
PICTURE pctfmt(round)low - < 0 = ' 0009.9%' (prefix='-')
0 - high = ' 0009.9%';
VALUE trafficfmt low - < 42.0 ='lightred'
42.0 - 45.0 ='lightorange'
45.0 - 55.0 ='lightgreen'
55.0 - 58.0 ='lightorange'
58.0 - 100 = 'lightred'
RUN;
PROC TABULATE
DATA=DATA_SALES
;
VAR Actual Previous ;
CLASS Product / ORDER=UNFORMATTED MISSING;
TABLE
Product={LABEL=''}
ALL={LABEL='Total' STYLE={Background=lightgray}} *
{STYLE={Background=lightgray}},
Actual={LABEL='Actual'}*F=COMMAX12.*
Sum={LABEL=''}
Actual={LABEL=' '} *F=pctfmt.*
COLPCTSUM<Actual>={LABEL='%'} *F=pctfmt.
Previous={LABEL='Previous'}*f=COMMAX12.*
Sum={LABEL=' '}
Previous={LABEL=''} *
COLPCTSum<Previous>={LABEL='%'} *F=pctfmt.
/ BOX={LABEL='Office' STYLE={FONT_FACE='Arial' FONT_SIZE=10PT FONT_WEIGHT=BOLD FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#333333}} ;
;
RUN;
RUN; QUIT;
TITLE; FOOTNOTE;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.