BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dsbihill
Obsidian | Level 7

I have working format and proc tabulate outputting the information i want.  I would like to add trafic lighting to this.  Is there a way that i can add Red and Green formatting to the below proc format statement?  I need to maintain the number formats and have the trafic lighting affect.  I have seen many options to do either of these alone, but how can i get both formats.

Thank you all very much.

proc format;

    picture thousands (round)

    0-High = '000,000,009 K' (mult=.001 prefix='$')

    LOW-0 = '000,000,009) K' (mult=.001 prefix='($');

Run;

proc tabulate data=temp_YTD_Cost_V

                out=test;

   

    var costv;

    class customer gd apg1 usage_type;

    table gd* apg1,

            customer='' * (usage_type='' all) * costv=''*f=thousands. * sum='';

   

run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I'm too lazy to build much of a data set without actual examples but this should get you started:

proc format library=work;

    picture thousands (round)

    0-High = '000,000,009 K' (mult=.001 prefix='$')

    LOW-0 = '000,000,009) K' (mult=.001 prefix='($');

  value traffic

    0-High = 'Green'

    LOW-0 = 'Red';

Run;

data temp_YTD_Cost_V;

input customer $ costv;

datalines;

A 10000000

A 3000000

B -500000

;

run;

proc tabulate data=temp_YTD_Cost_V

               ;

    var costv;

    class customer ;

    table customer,

  costv*{style=[backgroundcolor=traffic. ]}* sum=''*f=thousands. ;

run;

View solution in original post

2 REPLIES 2
ballardw
Super User

I'm too lazy to build much of a data set without actual examples but this should get you started:

proc format library=work;

    picture thousands (round)

    0-High = '000,000,009 K' (mult=.001 prefix='$')

    LOW-0 = '000,000,009) K' (mult=.001 prefix='($');

  value traffic

    0-High = 'Green'

    LOW-0 = 'Red';

Run;

data temp_YTD_Cost_V;

input customer $ costv;

datalines;

A 10000000

A 3000000

B -500000

;

run;

proc tabulate data=temp_YTD_Cost_V

               ;

    var costv;

    class customer ;

    table customer,

  costv*{style=[backgroundcolor=traffic. ]}* sum=''*f=thousands. ;

run;

dsbihill
Obsidian | Level 7

Works great, thank you so much for the help

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1032 views
  • 0 likes
  • 2 in conversation