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.