BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PhilipH
Quartz | Level 8


Hi SAS Experts,

I tried the following solution but the problem I discovered is that numbers who arent exponential are converted to something strange as well.
One of the problems might be that my source column/variable is actually of format "number" and the example creates values in format character.

http://stackoverflow.com/questions/19678279/sas-programming-convert-exponential-value-to-numeric-val...

data test;  
  a='3.24456545e-3'; output;  
  a='3.22254e2'; output;  
  a='9.151451'; output;  
  a='0.151451'; output;
run;  

data erg;  
  set test;  
  b=input(a,32.16);  
run; 

Are there other ways how to deal with exponentials that are of format "number" ?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Editor's Note: Thanks to @ballardw  and  @Ksharp  for providing examples of different informats that can be used to display the values without exponential notation. I have edited the response to  include them both here.

You don't mention what you may have read to text values but try something like:


data erg;  
  set test;  
  b=input(a,best32.);  
run; 

data erg;  
  set test;  
  b=input(a,e32.);  
run;

 

View solution in original post

4 REPLIES 4
ballardw
Super User

Editor's Note: Thanks to @ballardw  and  @Ksharp  for providing examples of different informats that can be used to display the values without exponential notation. I have edited the response to  include them both here.

You don't mention what you may have read to text values but try something like:


data erg;  
  set test;  
  b=input(a,best32.);  
run; 

data erg;  
  set test;  
  b=input(a,e32.);  
run;

 

Astounding
PROC Star

Why do you say there is any issue at all?  What results do you see when you add this statement to the final DATA step:

 

put a= b=;

Ksharp
Super User
data test;  
  a='3.24456545e-3'; output;  
  a='3.22254e2'; output;  
  a='9.151451'; output;  
  a='0.151451'; output;
run;  

data erg;  
  set test;  
  b=input(a,e32.);  
run; 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 35784 views
  • 4 likes
  • 5 in conversation