08-18-2014 04:06 PM
I am trying to do a simple TABULATE on an external data set on the IBM mainframe. If I use the REPORT proc, the dollar amounts are reported correctly. However if I try to sum up the dollar amounts using TABULATE, the sum is incorrect. I have tried this twice. Here are the control statements:
The number as it appears in the file looks like +00000100.00
Why does the report come out correct but the summing does not?
08-18-2014 04:15 PM
Not using charge variable for analysis in table statement. Try this.
Proc tabulate data=header;
class type account;
08-19-2014 12:10 PM
Thanks for the tip. I can report the numbers correctly using TABULATE, However, still having a little trouble. I would like my result table to look like below(or closest SAS equivalent):
| | CHARGE |
| | TYPE |
| | CHG | TAX | SUM |
| ACCOUNT | |
| 0000000001 | +100.00 | -110.00 | -10.00 |
| 0000000002 | +100.00 | +110.00 | +210.00 |
| 0000000003 | -100.00 | -110.00 | -210.00 | |
Given the following data(and assuming summing would work correctly if more than one line per acct/type):
I can kind of get what I want using below, but each account seems to get a separate table and the types line up vertically:
08-18-2014 04:30 PM
One possibility: Without the MISSING option, PROC TABULATE automatically removes any observation that has a missing value for a CLASS variable. So it could be throwing out observations before computing the sum.
08-19-2014 12:25 PM
It looks like your TABLE statement needs some work. This might be closer to what you need:
table account all, charge*type*sum=' ' charge*sum;
The comma is a key symbol in a TABLE statement. It means the definition of one dimension has ended and the definition of a new dimension begins. So with 2 commas, the first dimension is the page dimension, the second is the row dimension, and the third is the column dimension.