LaTeX forum ⇒ Graphics, Figures & TablesProblem on using -tabout- command in Stata for creating publ

Information and discussion about graphics, figures & tables in LaTeX documents.
Thong Nguyen
Posts: 1
Joined: Tue Sep 27, 2016 8:59 am

Problem on using -tabout- command in Stata for creating publ

Postby Thong Nguyen » Tue Sep 27, 2016 9:12 am

Dear all,

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).
  1. . do "C:\Users\THONG\AppData\Local\Temp\STD09000000.tmp"
  2.  
  3. . sysuse cancer, clear
  4. (Patient Survival in Drug Trial)
  5.  
  6. .
  7. .
  8. .
  9. . /*tex
  10. > tex \usepackage{booktabs}
  11. > tex \usepackage{tabularx}
  12. > tex*/
  13. .
  14. . texdoc init top, replace
  15. (texdoc output file is top.tex)
  16.  
  17. . /*tex
  18. > tex \begin{center}
  19. > tex \footnotesize
  20. > tex \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
  21. > tex \begin{tabularx} {#} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
  22. > tex \toprule
  23. > tex*/
  24. .
  25. . texdoc init bot, replace
  26. (texdoc output file is bot.tex)
  27.  
  28. . /*tex
  29. > tex \bottomrule
  30. > tex \addlinespace[.75ex]
  31. > tex \end{tabularx}
  32. > tex \par
  33. > tex \scriptsize{\emph{Source: }#}
  34. > tex \normalsize
  35. > tex \end{center}
  36. > tex*/
  37. .
  38. .
  39. . sysuse cancer, clear
  40. (Patient Survival in Drug Trial)
  41.  
  42. . la var died "Patient died"
  43.  
  44. . la def ny 0 "No" 1 "Yes", modify
  45.  
  46. . la val died ny
  47.  
  48. . recode studytime (min/10 = 1 "10 or less months") ///
  49. > (11/20 = 2 "11 to 20 months") ///
  50. > (21/30 = 3 "21 to 30 months") ///
  51. > (31/max = 4 "31 or more months") ///
  52. > , gen(stime)
  53. (46 differences between studytime and stime)
  54.  
  55. . la var stime "To died or exp. end"
  56.  
  57. . tabout stime died using table1.tex, ///
  58. > cells(freq col cum) format(0 1) clab(No. Col_% Cum_%) ///
  59. > replace ///
  60. > style(tex) bt cl1(2-10) cl2(2-4 5-7 8-10) font(bold) ///
  61. > topf(top.tex) botf(bot.tex) topstr(14cm) botstr(cancer.dta)
  62.  
  63. Table output written to: table1.tex
  64.  
  65. & \multicolumn{9}{c}{\textbf{Patient died}} \\
  66. \cmidrule(l{.75em}){2-10}
  67. \textbf{To died or exp. end} & \multicolumn{3}{c}{\textbf{No}} & \multicolumn{3}{c}{\textbf{Yes}} & \multicolumn{3}{c}{\textbf{Total}} \
  68. > \
  69. \cmidrule(l{.75em}){2-4} \cmidrule(l{.75em}){5-7}\cmidrule(l{.75em}){8-10}
  70. &No.&Col \%&Cum \%&No.&Col \%&Cum \%&No.&Col \%&Cum \% \\
  71. \midrule
  72. 10 or less months&4&23.5&23.5&15&48.4&48.4&19&39.6&39.6 \\
  73. 11 to 20 months&6&35.3&58.8&8&25.8&74.2&14&29.2&68.8 \\
  74. 21 to 30 months&2&11.8&70.6&7&22.6&96.8&9&18.8&87.5 \\
  75. 31 or more months&5&29.4&100.0&1&3.2&100.0&6&12.5&100.0 \\
  76. \textbf{Total}&17&100.0&&31&100.0&&48&100.0& \\
  77.  
  78. .
  79. end of do-file
  80.  
  81. .


Thank you all in advance. And sorry if I am asking silly things.

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests