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;
first divide your number by 100, then use the nlpctn6.2 format
Use the PERCENTN format and all is good
Thank you for replying @BrunoMueller. But PERCENTN didnt solve. It outputs as (75.43%). I want to display as -0.75%.
first divide your number by 100, then use the nlpctn6.2 format
@K1235 wrote:
Thank you for replying @BrunoMueller. 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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.