Dear Stata Forum,

I would like to use the collect command to make a table that has two frequency distributions (from two different variables) next to each other.
Below I have started an example that would place the actual repair records of cars in the auto data set next to their expected repair records (a new variable I made) so the two distributions can be easily compared.

I have used the table command to show and collect the percentages I want in each column. However, I have been unable to place the two sets of percentages next to each other in one table. I think the "collect layout" command and the dimension called "across" might be useful here, but I can't seem to get it right.

Any suggestions would be appreciated.

Thanks,

Jeremy


Code:
sysuse auto, clear

*actual repair record
tab rep78

*expected repair record
gen rep78_exp = rep78+(round( runiform(0,1)))
    replace rep78_exp = 5 if rep78_exp==6
label var rep78_exp "expected repair record"
tab1 rep78 rep78_exp

*separate tables for actual and expected repair record
collect clear
table rep78, stat(percent)
table rep78_exp, stat(percent) append

*one table: col1 = expected repair record; col2=actual repair record
collect dims
collect label list across