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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.