APPLICATION | NEW | SAPPLICATION |
S1 | ||
S2 | ||
S3 | 3E+14 | 300000002035314 |
S4 | 3E+14 | 300000002227110 |
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.
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.
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.
You may want to try formatting NEW with the best32. format when you read the data in.
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.
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.
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.
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.