BookmarkSubscribeRSS Feed
chinna0369
Pyrite | Level 9

Hi, 

 

I have a value like "-2.22045E-16", how can I change it to "-2.2E-16 "?

 

Thanks,

Adithya

2 REPLIES 2
ballardw
Super User

@chinna0369 wrote:

Hi, 

 

I have a value like "-2.22045E-16", how can I change it to "-2.2E-16 "?

 

Thanks,

Adithya


Don't change "value" change the format:

data junk;
   x=-2.22045E-16;
   put 'BEST9 format ' x=best9.;
run;

If you have different ranges of values that you want displayed differently you can use a custom format to display different ranges of values with different numeric formats:

data junk;
   input x;
datalines;
.0003
15
123456.78
12E27
;
run;

proc format library=work;
value myrange
0 - <1 = [f8.6]
1 - <500000 = [comma13.3]
500000 - high = [best8.]
;
run;

proc print data=junk;
   format x myrange.;
run;

the [formatname] in proc format code says to use an existing format to display values in a given range group.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 484 views
  • 0 likes
  • 3 in conversation