This would be my 2nd thread here. I'll waste no time here. My situation is as follows:
Basically I have already done a proc tabulate to tabulate the values for var A together with var B, in 12 period (can be considered 12 months) and then total up the values.
proc tabulate data = abc;
var a b;
table a*f=comma9.1 b*f=percentn9.2, period=' '*SUM=' ' ALL='Total'*SUM=' ';
The result is as below:
Period 1 2 3 4 5......... 12 Total
A 12 42 32 11 43........ 71 425
B 21.1% 38.2% 12.5% 3.0% 11.1%....41.1% 230.2%
My problem is, whatever i do or try to change, the total will always add up especially for var B, which is not correct as the correct value should be the calculation between 2 other variables (which are A/x) that are used to calculate percentage of B.
Is there any anything I can do to correct the total % of B so that it will relect the correct % value (total A divided by total x) using proc tabulate?
In this case, I believe the "ALL" statement will not give you what you need. You could bring the x variable into a proc report and use a compute block. Or you could calculate the totals before displaying the data with proc tabulate. Here's a sample way to the second approach.