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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1074 views
  • 0 likes
  • 4 in conversation