This is I'm afraid one of many variants of this type of question about the table collect commands on the list but I can't find a solution that works in my case.
I am trying to add the number of observations to a table which collects margins results.
I followed the instructions in the first example in the "Remarks and Examples" section of the manual collect addtags entry https://www.stata.com/manuals/tablescollectaddtags.pdf
but although the table shows all the results I want, it does not add the number of observations as the last row.
Here is a toy example
I am trying to add the number of observations to a table which collects margins results.
I followed the instructions in the first example in the "Remarks and Examples" section of the manual collect addtags entry https://www.stata.com/manuals/tablescollectaddtags.pdf
but although the table shows all the results I want, it does not add the number of observations as the last row.
Here is a toy example
Code:
clear sysuse auto gen highqual=rep78>3 regress mpg i.foreign i.highqual collect clear collect _r_b _r_ci,tags(rowheader["Group means mpg"]): margins foreign collect _r_b _r_ci,tags(rowheader["Difference (mpg)"]): margins r.foreign collect _r_b _r_ci,tags(rowheader["Group means quality"]): margins highqual collect _r_b _r_ci,tags(rowheader["Difference (quality)"]): margins highqual collect addtag extra[N], fortags(result[N]) collect recode result N=_r_b collect label levels extra N "Observations" collect layout (rowheader#colname extra) (result[_r_b _r_ci]) collect style cell, nformat(%5.2f) collect style cell result[_r_ci], sformat("[%s]") cidelimiter(", ") collect style cell result[_r_b], halign(center) collect label levels colname 1.highqual "high quality" 0.highqual "low quality" r1vs0.highqual "High vs Low" collect label levels result _r_b "mpg",modify collect preview
Comment