BookmarkSubscribeRSS Feed
loli
Calcite | Level 5

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

  1. 16.220
  2. 37.5%
  3. 71.394
  4. 39.3%

South

  1. 10.797
  2. 24.9%
  3. 37.095
  4. 20.4%

East

  1. 5.938
  2. 13.7%
  3. 27.072
  4. 14.9%

West

  1. 2.490
  2. 5.8%
  3. 11.846
  4. 6.5%

NorthE

  1. 4.001
  2. 9.2%
  3. 18.016
  4. 9.9%

SouthE

  1. 3.857
  2. 8.9%
  3. 16.357
  4. 9.0%

Total

  1. 43.303
  2. 100.0%
  3. 181.780
  4. 100.0%
2 REPLIES 2
ballardw
Super User

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?

loli
Calcite | Level 5

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 760 views
  • 0 likes
  • 2 in conversation