I've had better luck writing code that writes my SQL. I wrote a set of code that you point at any table, it accepts any column within the table as the top or left portion of the crosstab and any numeric column as the data portion. Another option is to calculate as percent of the whole or sum or count.
Doing it that way, you have one set of reusable code for all crosstabs...works pretty well. I usually just create a simple view, point the object at the view and Voila have instant reconfigurable, groupable by anything crosstab. I even added an option to subgroup on the left side.
Same concept, more code up front, but infinitely reusable.