DATA Step, Macro, Functions and more

Proc Report Format percentage

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Proc Report Format percentage

[ Edited ]

I have a dataset which one of the column has a value of "-0.75" but in proc report I want to display as "-0.75%". When I apply the format percent9.2 it converts to "(75.435)". But I want to display as "-0.75%".

 

data Percent;
format x BEST8.
p1 PERCENT7.1;
label x = "Raw value"
p1 = "PERCENT7.1";
input x @@;
p1 = x;

datalines;
1.85185 3.44498 -0.92507 -0.7543456
;

proc print data=Percent noobs label; run;

Accepted Solutions
Solution
‎10-12-2017 12:38 PM
Respected Advisor
Posts: 2,802

Re: Proc Report Format percentage

first divide your number by 100, then use the nlpctn6.2 format

--
Paige Miller

View solution in original post


All Replies
SAS Super FREQ
Posts: 810

Re: Proc Report Format percentage

Use the PERCENTN format and all is good

Occasional Contributor
Posts: 7

Re: Proc Report Format percentage

Posted in reply to Bruno_SAS

Thank you for replying @Bruno_SAS. But PERCENTN didnt solve. It outputs as (75.43%). I want to display as -0.75%. 

Solution
‎10-12-2017 12:38 PM
Respected Advisor
Posts: 2,802

Re: Proc Report Format percentage

first divide your number by 100, then use the nlpctn6.2 format

--
Paige Miller
Super User
Posts: 13,292

Re: Proc Report Format percentage


K1235 wrote:

Thank you for replying @Bruno_SAS. But PERCENTN didnt solve. It outputs as (75.43%). I want to display as -0.75%. 


Show the code. One suspects you missed the format spelling. And a value to appear as -0.75% would have to be -.0075 as a decimal.

 

data junk;
   x=-.007543;
run;
proc print data=junk;
   format x percentn10.4;
run;
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 161 views
  • 0 likes
  • 4 in conversation