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.

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 558 views
  • 0 likes
  • 3 in conversation