DATA Step, Macro, Functions and more

Proc Format / Tabulate Multiple formats question

Accepted Solution Solved
Reply
Contributor
Posts: 53
Accepted Solution

Proc Format / Tabulate Multiple formats question

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;


Accepted Solutions
Solution
‎05-15-2014 12:20 PM
Super User
Posts: 10,535

Re: Proc Format / Tabulate Multiple formats question

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


All Replies
Solution
‎05-15-2014 12:20 PM
Super User
Posts: 10,535

Re: Proc Format / Tabulate Multiple formats question

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;

Contributor
Posts: 53

Re: Proc Format / Tabulate Multiple formats question

Works great, thank you so much for the help

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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