BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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