Let me be very clear what I’m asking. This is about tables of means, lots of them, 65 – 100 pages of them, integrated with explanatory text. Most social scientists don’t do this kind of stuff, but I do in my “public sociology” work. I need to generate reports that integrate text with LOTS of tables of means cross-classified by race, offense, geographic location, type of statistic. I need to be able to control what headers get put on columns and I need to have every table be output with enough information to be absolutely sure what it is. I have a lot of better things to do with my time than spending hours merging files and reformatting tables. I really need to automate this stuff. I use Stata, I love Stata, but I’m about ready to kill either myself or Stata. It is a program for doing umpty-ump zillion flavors of regression and there are some wonderful ado files for reformatting regression results (outreg2 and estout are lovely for regressions, but useless for this problem). I’ve gotten quite good at making pretty graphs from it too. But tables remain a nightmare. The Stata commands that generate means include tabstat and table with the c() option. Both are pretty restrictive in what they can produce and have the additional badness that they print the tables with spaces instead of tabs so that the tables in the log file cannot be automatically reformatted by a spreadsheet or word processor. I even looked at the smcl output to see if the tables in it were tab delimited (no, they are not) or had maker codes that could be used to insert tabs (not that I could see). You can get the tabs with the “copy table” option, but doing it manually that way for hundreds of tables is horrible, to say the least. An ado named tabout works pretty well when it works, but it is also pretty restrictive in what it can do has has its own internal logic (invisible to the naive user) about what it will put in the column headings. I’ve done some stuff with file write , but this is very cumbersome and I keep making mistakes — it is very hard to get it right. I’ve tried all sorts of Google searches to see if someone in the Stata community has written something to deal with this, and I’ve gotten some useful leads, but not enough to actually solve the problem. I see references to collapsing things and then outsheet-ing or putting it in a matrix and then somehow translating the matrix, but I have just gotten my brain all jumbled up and I can’t get things to work right. So, that is the question. Do you know how or do you know of a tutorial that explains how to do this kind of thing? Not just vague references to it being possible to do it, but actual examples of the code that does it. Or, is there some other software that does it easily enough that it would be worth my while porting the data to a new program?
For my last effort — done to a deadline — I just worked with the log file. I had to keep everything in Courier or the tables screwed up, and the only thing I could control to get things to fit right on the page was the font size, so I just manually went through the log file putting in page breaks, manually choosing portrait or landscape for particular sections, and changing the font sizes as needed to get the tables to print decently. I had to keep the original ugly variable names because, of course, I could not control the output well enough to edit them. Ugh. Anyway, if you have some useful pointers, please drop them in the comments.