I am new to LaTeX, so I do not know how to use it. I found the following tutorial of -tabout- command, which is a program for Statalists. I tried to run the following codes that I have copied, pasted, edited quotation marks as the tutorial suggested. You can see it by clicking on the following link because of it's too big and I cannot attach it here.
http://www.ianwatson.com.au/stata/tabout_tutorial.pdf
Unfortunately, it did not work. How to fix them in order to have a 'standard table', such as Table 1 in the tutorial (on page # 13).
Code: Select all
. do "C:\Users\THONG\AppData\Local\Temp\STD09000000.tmp"
. sysuse cancer, clear
(Patient Survival in Drug Trial)
.
.
.
. /*tex
> tex \usepackage{booktabs}
> tex \usepackage{tabularx}
> tex*/
.
. texdoc init top, replace
(texdoc output file is top.tex)
. /*tex
> tex \begin{center}
> tex \footnotesize
> tex \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
> tex \begin{tabularx} {#} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
> tex \toprule
> tex*/
.
. texdoc init bot, replace
(texdoc output file is bot.tex)
. /*tex
> tex \bottomrule
> tex \addlinespace[.75ex]
> tex \end{tabularx}
> tex \par
> tex \scriptsize{\emph{Source: }#}
> tex \normalsize
> tex \end{center}
> tex*/
.
.
. sysuse cancer, clear
(Patient Survival in Drug Trial)
. la var died "Patient died"
. la def ny 0 "No" 1 "Yes", modify
. la val died ny
. recode studytime (min/10 = 1 "10 or less months") ///
> (11/20 = 2 "11 to 20 months") ///
> (21/30 = 3 "21 to 30 months") ///
> (31/max = 4 "31 or more months") ///
> , gen(stime)
(46 differences between studytime and stime)
. la var stime "To died or exp. end"
. tabout stime died using table1.tex, ///
> cells(freq col cum) format(0 1) clab(No. Col_% Cum_%) ///
> replace ///
> style(tex) bt cl1(2-10) cl2(2-4 5-7 8-10) font(bold) ///
> topf(top.tex) botf(bot.tex) topstr(14cm) botstr(cancer.dta)
Table output written to: table1.tex
& \multicolumn{9}{c}{\textbf{Patient died}} \\
\cmidrule(l{.75em}){2-10}
\textbf{To died or exp. end} & \multicolumn{3}{c}{\textbf{No}} & \multicolumn{3}{c}{\textbf{Yes}} & \multicolumn{3}{c}{\textbf{Total}} \
> \
\cmidrule(l{.75em}){2-4} \cmidrule(l{.75em}){5-7}\cmidrule(l{.75em}){8-10}
&No.&Col \%&Cum \%&No.&Col \%&Cum \%&No.&Col \%&Cum \% \\
\midrule
10 or less months&4&23.5&23.5&15&48.4&48.4&19&39.6&39.6 \\
11 to 20 months&6&35.3&58.8&8&25.8&74.2&14&29.2&68.8 \\
21 to 30 months&2&11.8&70.6&7&22.6&96.8&9&18.8&87.5 \\
31 or more months&5&29.4&100.0&1&3.2&100.0&6&12.5&100.0 \\
\textbf{Total}&17&100.0&&31&100.0&&48&100.0& \\
.
end of do-file
.