SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
hbergen
Calcite | Level 5


I am hoping there is an easy solution to this that I'm overlooking, but here is my problem:

I have a CHARACTER value stored as '8.8242e+13'

I would like to convert this to a character value stored as '88242000000000'

I would greatly appreciate any suggestions.

2 REPLIES 2
Astounding
PROC Star

The conversions aren't difficult, although you may need to consider a couple of questions.  How many characters should be used to store the final character variable?  Should the results be left-justified or right-justified?  Here's one approach:

new_variable = put( input(old_variable,10.), best14.);

Good luck.

_maldini_
Barite | Level 11

@Astounding

 

I have a similar question.

 

I have a variable whose values are numbers. Some of the values are listed in scientific notation, the majority are simply strings of numbers. I want the variable to be numeric and w/o the scientific notation.

 

When I read-in the data using a DATA step, and apply a character informat ($20.), the numbers no longer have the scientific notation. Great, except when I convert the character variable to numeric, the scientific notation returns.

 

numeric_Part_FB_ID = INPUT (Part_FB_ID, BEST32.);

 

When I read-in the data and apply a numeric informat (BEST32.), the values are listed in scientific notation.

 

What am I doing wrong here? 

 

Thanks!

 

 

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 17919 views
  • 1 like
  • 3 in conversation