New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
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!

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1198 views
  • 1 like
  • 2 in conversation