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

Hi,

 

I am using a picture format to display '%' in proc tabulate output. Using this format is however changing the negative values to positive.

 

Code I am using.

proc format;

picture mypercent_pict (round) low-high = "009.99%";

run;


proc tabulate data=dataset;
class Month ;
var Segment Total;
table Month='', (Total*sum=""*f=comma12. Segment=""*(sum="segment"*f=comma12. pctsum<Total>="Segment as %"*f=mypercent_pic));
run;

 

If I don't use "*f=mypercent_pic" I get the following output:

Month       Total        Segment             Segment as %
Jul-18       689,039       1,194,031           173.29
Aug-18    -353,108       1,409,626          -399.21
Sep-18    -886,771       1,144,431          -129.06

 

However, using the mypercent_pict format gets rid of the negative sign.

 

Month       Total        Segment             Segment as %
Jul-18       689,039       1,194,031          173.29%
Aug-18    -353,108       1,409,626          399.21%
Sep-18    -886,771       1,144,431          129.06%

 

Any suggestions to get the output as -399.21% and -129.06% in the table?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

When using picture-formats you have to tell sas that negative numbers need special formatting:

 

proc format;
   picture mypercent_pict (round)
      low -< 0 = "009.99%" (prefix = "-")
      0 - high = "009.99%"
   ;
run;

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

When using picture-formats you have to tell sas that negative numbers need special formatting:

 

proc format;
   picture mypercent_pict (round)
      low -< 0 = "009.99%" (prefix = "-")
      0 - high = "009.99%"
   ;
run;
Rohit_R
Obsidian | Level 7
Thanks Andreas!