DATA Step, Macro, Functions and more

Convert EXP value

Reply
Contributor
Posts: 56

Convert EXP value

Hi,

Do you know what is the SAS function or routine that can convert a string such as
7.8E+5 or 000078E-5 into the correct numeric values with decimal places? I tried the EXP function but the base values already defined e.

Thanks
Kwok
Trusted Advisor
Posts: 2,113

Re: Convert EXP value

Checkout the "E" informat.
N/A
Posts: 0

Re: Convert EXP value

Hi,Kwok
Here is the codes:
data _null_;
p='7.8E+5';
o=input(p,12.2);
put p o;
run;
Contributor
Posts: 56

Re: Convert EXP value

Thanks for your code. But how do you determine the 12.2 ? If the data stream variable E formay such as 7.8E+5, 7.8E-7, 8.1005E+13 ..., how would you define the informat value ?

Thanks
Super Contributor
Posts: 394

Re: Convert EXP value

Generally you don't have to. If the data contain decimal points the decimal value is ignored. Here's the doc: http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000204411.htm.
Contributor
Posts: 56

Re: Convert EXP value

Thanks Tim,
Ask a Question
Discussion stats
  • 5 replies
  • 277 views
  • 0 likes
  • 4 in conversation