SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Kwok
Calcite | Level 5
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
5 REPLIES 5
Doc_Duke
Rhodochrosite | Level 12
Checkout the "E" informat.
deleted_user
Not applicable
Hi,Kwok
Here is the codes:
data _null_;
p='7.8E+5';
o=input(p,12.2);
put p o;
run;
Kwok
Calcite | Level 5
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
Tim_SAS
Barite | Level 11
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.
Kwok
Calcite | Level 5
Thanks Tim,

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1808 views
  • 0 likes
  • 4 in conversation