data ex ;
number=102 ;
format number percent7.2 ;
run;
value should be come like 102.00% .
I have tried above program it is not working.
Percent values are kept in SAS as relational values, so 102% is stored as 1.02 and displayed as 102.00% by the percent format.
The PERCENT and PERCENTN format multiply by 100 so the value to be displayed should be a proportion.
35 data _null_;
36 do number=102,-102,1.02,-1.02;
37 put number=percentn12.2;
38 end;
39 run;
number=10200.00%
number=-10200.00%
number=102.00%
number=-102.00%
proc format;
picture fmt
low-high='000.99%';
run;
data ex ;
number=102 ;
format number fmt. ;
run;
You can also add the round() function to avoid truncation
proc format;
picture fmt
low-high='999.99%';
run;
data ex ;
number=102 ;
number2 = round(number,.01);
format number2 fmt.;
run;
proc format has such kind of option ROUND .
proc format;
picture fmt(round)
low-high='999.99%';
run;
To convert 102 into 102% you just need to divide it by 100.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.