Some code and output of what you currently have needs rearranging and the rules would be helpful. Also what defines the groups that need subtotaling. Also you might show some of the SurveyFreq code, the input and output you're using and what you would actually like to have. It may be that the approach you used for Surveyfreq could be improved. Or possibly start a separate thread for this part.
... View more