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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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