Hi,
proc sql;
create table snp as
select sum(Amount) as amt
from tbl
group by prdct
quit;
When i am summing the amount when the sum value is zero it's generating exponential value. what's causing the problem
I have amounts like below
Amount
208990.99 |
547244.6 |
91914.11 |
-208990.99 |
-91914.11 |
-547244.6 |
I used round function to overcome the problem but curious what caused the problem and using the round function appropriate solution?
This is what i used
proc sql;
create table snp as
select round(sum(Amount),0.01) as amt
from tbl
group by prdct
quit;
My guess is that you're not getting Exponential values but, rather, large numbers being shown using scientific notation.
If so, rather than outputing the sums, output sum(amount)/1000000 and that way you wil get the sum of number of millions.
Art, CEO, AnalystFinder.com
What @art297 said, but you're getting really small numbers - ie 2.4X10^-13 or something like that? This has to do with numerical precision and how SAS can store numbers. It's a common issue in programming across all languages and more of a binary computer issue. Until we get quantam 🙂
And it may just be that the format is too small to display well.
data _null_; x=12345678; put x= best4.; run;
Displays x as 12E6 because I told it display with only 4 columns. So the closest value SAS can display with 4 columns is the exponential.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.