I suggest that the first thing you do is use the "Summary Statistics" task to summarize your data and get the numbers you need.
On your TableA, I'm going to use A, B, C, etc. to refer to the columns.
1. Open the Summary Statistics task
2. Use columns C, D, E as Classification Variables
3. Use columns F, G, H as Analysis Variables
4. On the "Statistics" tab, untick everything, and tick Sum and Number of observations
5. On the Results tab,
a Turn N-way only into All ways
b Untick Show statistics
c Tick Save statistics to data set
6. Run the task
The output dataset will be a cross-classification of C, D, and E, which will include the numbers you want. Taking C as an example:
The line with C=1 and _TYPE_=100 will be the results for column C; F_N will be the count of matching rows, and F_Sum will be the principal balance. Same for D and E.
You can extract and rename these rows using the query builder, or by writing a quick data step.
Tom