okay, so i imported a couple of tables and am building a table out of the data. the table is 5x5. so i have 4 columns that need to be summed and put into fields then i need to subtract those fields to fill in the third row. so after searching i found i could use macro variables to get the data inot variables and subtract them.. however, the column i am summing, even though i put the format importing as commaw.d, after summing is getting put into the table in **bleep** scientific notation which i cannot understand why since the columns are set up as decimal 20,2 which should be enough room for anything but it INSISTS!
so now when i subtract the variables, i get an error and cannot figure out how to get the values into numeric format so i can evaluate.
SAS Output
Apr File | 98452574 | 3185241 | -256020 | -5.679E7 | |
Mar File | 41736721 | 2.0938E8 | -1.319E7 | -3.514E7 | |
Current Months File | 56715853 | . | . | . | |
Current Months S File | . | . | . | . | |
Difference | . | . | . | . |
Switch from %EVAL to %SYSEVALF. %EVAL works with integers only, but %SYSEVALF can work with both decimal fractions and scientific notation.
Switch from %EVAL to %SYSEVALF. %EVAL works with integers only, but %SYSEVALF can work with both decimal fractions and scientific notation.
thanks astounding. that worked perfectly. one further thing, why is the data being put into sci format and how can i put it into numeric format (integers, decimals)? everything works as is and i know i can pull using a format so it is not there but for my curiosity...
I'm not sure this is the "why" for this particular case, but there is a general principle. If you assign a format to a variable, SAS goes out of its way to respect the width of the format. With a comma w.d format, SAS will do whatever it takes to express the value with a width of "w" (including using scientific notation of necessary).
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!
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.