\documentclass[12pt]{article} \newcommand{\bs}{$\backslash$} \begin{document} \section{Command {\tt sutex}} Stata command {\tt sutex} is a user-written program. It generates LaTeX code for summary statistics tables. \subsection{Example 1: Summarizing all the variables} The default for command {\tt sutex} only displays the mean and the standard deviation for each of the numeric variables. In case there are missing values for some of the variables, it also displays a column of number of observations. \begin{small} \begin{verbatim} . use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear (highschool and beyond (200 cases)) . summarize Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- id | 200 100.5 57.87918 1 200 female | 200 .545 .4992205 0 1 race | 200 3.43 1.039472 1 4 ses | 200 2.055 .7242914 1 3 schtyp | 200 1.16 .367526 1 2 -------------+-------------------------------------------------------- prog | 200 2.025 .6904772 1 3 read | 200 52.23 10.25294 28 76 write | 200 52.775 9.478586 31 67 math | 200 52.645 9.368448 33 75 science | 200 51.85 9.900891 26 74 -------------+-------------------------------------------------------- socst | 200 52.405 10.73579 26 71 . sutex %------- Begin LaTeX code -------% \begin{table}[htbp]\centering \caption{Summary statistics \label{sumstat}} \begin{tabular}{l c c }\hline\hline \multicolumn{1}{c}{\textbf{Variable}} & \textbf{Mean} & \textbf{Std. Dev.} \\ \hline id & 100.5 & 57.879 \\ female & 0.545 & 0.499 \\ race & 3.43 & 1.039 \\ ses & 2.055 & 0.724 \\ schtyp & 1.16 & 0.368 \\ prog & 2.025 & 0.690 \\ read & 52.23 & 10.253 \\ write & 52.775 & 9.479 \\ math & 52.645 & 9.368 \\ science & 51.85 & 9.901 \\ socst & 52.405 & 10.736 \\ \multicolumn{1}{c}{N} & \multicolumn{2}{c}{200}\\ \hline \end{tabular} \end{table} %------- End LaTeX code -------% \end{verbatim} \end{small} \begin{table}[htbp]\centering \caption{Summary statistics \label{sumstat}} \begin{tabular}{l c c }\hline\hline \multicolumn{1}{c}{\textbf{Variable}} & \textbf{Mean} & \textbf{Std. Dev.} \\ \hline id & 100.5 & 57.879 \\ female & 0.545 & 0.499 \\ race & 3.43 & 1.039 \\ ses & 2.055 & 0.724 \\ schtyp & 1.16 & 0.368 \\ prog & 2.025 & 0.690 \\ read & 52.23 & 10.253 \\ write & 52.775 & 9.479 \\ math & 52.645 & 9.368 \\ science & 51.85 & 9.901 \\ socst & 52.405 & 10.736 \\ \multicolumn{1}{c}{N} & \multicolumn{2}{c}{200}\\ \hline \end{tabular} \end{table} \subsection{ Example 2: Displaying min and max of each variable} The default for command {\tt sutex} only displays the mean and the standard deviation for each of the numeric variables. In case there are missing values for some of the variables, it also displays a column of number of observations. \begin{small} \begin{verbatim} . sutex , minmax %------- Begin LaTeX code -------% \begin{table}[htbp]\centering \caption{Summary statistics \label{sumstat}} \begin{tabular}{l c c c c }\hline\hline \multicolumn{1}{c}{\textbf{Variable}} & \textbf{Mean} & \textbf{Std. Dev.}& \textbf{Min.} & \textbf{Max.} \\ \hline id & 100.5 & 57.879 & 1 & 200 \\ female & 0.545 & 0.499 & 0 & 1 \\ race & 3.43 & 1.039 & 1 & 4 \\ ses & 2.055 & 0.724 & 1 & 3 \\ schtyp & 1.16 & 0.368 & 1 & 2 \\ prog & 2.025 & 0.690 & 1 & 3 \\ read & 52.23 & 10.253 & 28 & 76 \\ write & 52.775 & 9.479 & 31 & 67 \\ math & 52.645 & 9.368 & 33 & 75 \\ science & 51.85 & 9.901 & 26 & 74 \\ socst & 52.405 & 10.736 & 26 & 71 \\ \multicolumn{1}{c}{N} & \multicolumn{4}{c}{200}\\ \hline \end{tabular} \end{table} %------- End LaTeX code -------% \end{verbatim} \end{small} \begin{table}[htbp]\centering \caption{Summary statistics \label{sumstat}} \begin{tabular}{l c c c c }\hline\hline \multicolumn{1}{c}{\textbf{Variable}} & \textbf{Mean} & \textbf{Std. Dev.}& \textbf{Min.} & \textbf{Max.} \\ \hline id & 100.5 & 57.879 & 1 & 200 \\ female & 0.545 & 0.499 & 0 & 1 \\ race & 3.43 & 1.039 & 1 & 4 \\ ses & 2.055 & 0.724 & 1 & 3 \\ schtyp & 1.16 & 0.368 & 1 & 2 \\ prog & 2.025 & 0.690 & 1 & 3 \\ read & 52.23 & 10.253 & 28 & 76 \\ write & 52.775 & 9.479 & 31 & 67 \\ math & 52.645 & 9.368 & 33 & 75 \\ science & 51.85 & 9.901 & 26 & 74 \\ socst & 52.405 & 10.736 & 26 & 71 \\ \multicolumn{1}{c}{N} & \multicolumn{4}{c}{200}\\ \hline \end{tabular} \end{table} \end{document}