SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EinarRoed
Pyrite | Level 9

I've got two source tables. Both contain a numeric variable called SUM. I'll call them SUM_A and SUM_B.

 

SUM_A can sometimes be displayed using a scientific notation. SUM_B is always displayed as a plain number.

 

I need to add SUM_A to SUM_B. I've made the new variable SUM_TOTAL (format: comma20.) which uses this expression: SUM_A + SUM_B

 

When SUM_A uses a scientific notation, then the end result is always equal to SUM_B. Example:

EinarRoed_0-1638790901245.png

How can I make SUM_TOTAL display SUM_A + SUM_B?

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
PaigeMiller
Diamond | Level 26

Try format BEST20.

--
Paige Miller
Kurt_Bremser
Super User

And when adding very small numbers to considerably large numbers, you will run into the limits of numeric precision. Keep in mind that only 15 to 16 decimal digits can be stored reliably in 8-byte real.

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 579 views
  • 3 likes
  • 3 in conversation