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

APPLICATION

NEWSAPPLICATION
S1  
S2  
S33E+14300000002035314
S43E+14300000002227110

Hello,

Above is a piece of my table, what I want to do is when New=blank, then new=sapplication;

DATA want;

SET have;

IF NEW = '.' THEN DO;

NEW= TRIM(PUT(SAPPLICATION,15.-L))

;

END;

run;

 

but the new is still in the format of 3E+14. can someone help this? thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

So NEW should be numeric.

 

It looks like SAPPLICATION is also numeric.  Correct me if I'm wrong about that, but the use of the PUT function suggests that it is numeric.

 

In that case, the correct syntax would be:

 

if new = . then new = sapplication;

format new 15.;

 

If this still generates scientific notation, that's a result of the printing format used when printing not being physically wide enough to hold 15 digits, not a result of what is contained in the data.

View solution in original post

6 REPLIES 6
TheShark
Obsidian | Level 7

Could you create NEW as character instead of numeric or do you need it for calculations? It looks like you're running into long number issues.

septemberbulb
Obsidian | Level 7
It is better to keep it as numeric.
jnvickery
Obsidian | Level 7

You may want to try formatting NEW with the best32. format when you read the data in.

ballardw
Super User

DATA want;

SET have;

IF NEW = '.' THEN DO;

NEW= TRIM(PUT(SAPPLICATION,15.-L))

;

FORMAT New best16.;

END;

run;

 

SAS Formats control appearance of values but are not changing the actual values.

septemberbulb
Obsidian | Level 7
Thank you.
Astounding
PROC Star

So NEW should be numeric.

 

It looks like SAPPLICATION is also numeric.  Correct me if I'm wrong about that, but the use of the PUT function suggests that it is numeric.

 

In that case, the correct syntax would be:

 

if new = . then new = sapplication;

format new 15.;

 

If this still generates scientific notation, that's a result of the printing format used when printing not being physically wide enough to hold 15 digits, not a result of what is contained in the data.

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
  • 6 replies
  • 1392 views
  • 1 like
  • 5 in conversation