Suppose I have 12 records, one per month. One variable on the record represents the dollar value of all loans defaulted within that month. The other variable on these monthly records, however, is not really "monthly". It represents the total value of all outstanding loans at this point in time.
This works well for a monthly report. To calculate the percentage of defaulted loans, simply divide the value of the defaulted loans by the total value of all outstanding loans found on the monthly record. Since both of these variables are on the same record, it is quite easy.
For a monthly report you would do the following:
proc tabulate data=myinput;
class asofmonth;
var default outstanding;
table default =' '*sum='Default $'
outstanding =' '*sum='Outstanding'
default =' '*pctsum='Default Percent',
asofmonth
If you want to do a quarterly report however, things get a little more complicated. For the numerator you simply sum the value of defaulted loans for the three months. For the denominator you cannot sum the values, but MUST use the average of the three months.
My question is this: How do you tell tabulate to use the average for the denominator? Is that possible?
proc tabulate data=myinput;
class asofquarter;
var default outstanding;
table default =' '*sum='Default $'
outstanding =' '*mean='Outstanding'
default =' '*?????????????='Default Percent',
asofquarter
Mathematically what I would like where the ?????? are is the mean of the outstandings calculated for this quarter.
What is the syntax to accomplish this? Is it even possible?