I would like to be able to export a series of two-way tables, with contents as a percent of the column total, with row and column labels into excel. It seems that there are two ways I could potentially do this- 1) save a table as a matrix and then use putexcel to export it, or 2) use collapse to reduce my dataset to the variables of interest and use export excel from there. However, I'm having difficulty completing either of these options in a way that preserves the row and column labels in the table.
For example, below is an example of the form of a table that I would like to be export.
Does anyone have a recommendation for the best way to do this?
For example, below is an example of the form of a table that I would like to be export.
Code:
webuse citytemp2, clear (City Temperature Data) . . tab region agecat, column nofreq Census | agecat Region | 19-29 30-34 35+ | Total -----------+---------------------------------+---------- NE | 9.07 26.27 27.82 | 17.36 N Cntrl | 31.95 29.11 22.56 | 29.71 South | 27.42 21.52 32.33 | 26.15 West | 31.56 23.10 17.29 | 26.78 -----------+---------------------------------+---------- Total | 100.00 100.00 100.00 | 100.00
Comment