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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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