I'm really new to LaTeX so I apologize if this is a really basic question. I am trying to create tables from STATA (a statistical suite) using laTeX and have generated the following table code. However, I keep getting the Missing \begin{document} error whenever I try to render the table.
\begin{center}
\footnotesize
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\begin{tabularx} {14cm} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
\toprule
& \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& \\
\bottomrule
\addlinespace[.75ex]
\end{tabularx}
\par
\scriptsize{\emph{Source: }cancer.dta}
\normalsize
\end{center}
latexdocument, beginning with\documentclass{...}and ending with\end{document}– Zarko May 28 '18 at 19:00