BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6

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.

7 REPLIES 7
tomrvincent
Rhodochrosite | Level 12
data ex;
format number percent9.2;
number=1.02;
run;
data_null__
Jade | Level 19

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%
Ksharp
Super User
proc format;
picture fmt
low-high='000.99%';
run;

data ex ;
number=102 ;
format number fmt. ;
run;
ed_sas_member
Meteorite | Level 14

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;
Ksharp
Super User

proc format has such kind of option ROUND .

 

proc format;
picture fmt(round)
low-high='999.99%';
run;
Tom
Super User Tom
Super User

To convert 102 into 102% you just need to divide it by 100.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 10260 views
  • 0 likes
  • 7 in conversation