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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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