[Tex/LaTex] inserting external LaTeX tables made by Stata into Scientific Workplace 5.50

tables

I am trying to insert a table of statistical output into SWP 5.50 from an external file. The table is generated by my statistics program, and it looks something like this:

\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{OLS Results}
\begin{tabular}{l*{1}{c}}
\hline\hline
                    &\multicolumn{1}{c}{Price}\\
\hline
Mileage (mpg)       &      -294.2\sym{***}\\
                    &     (-5.28)         \\
Foreign             &      1767.3\sym{*}  \\
                    &      (2.52)         \\
Constant            &     11905.4\sym{***}\\
                    &     (10.28)         \\
\hline
Observations        &          74         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
\end{table}

When I use the Import Non-SWP/SW LaTeX function, I get the error that the file is not valid for the selected filter. I am able to insert figures. I can insert it as a TeX Field, but that makes it hard to update when I change the specification of the regression.

Any advice about how to get this to work? I've not been able to locate any info on this in the MacKichan forum or anywhere else on the web.

Best Answer

There are several ways to import tabular data into SWP. There is an easy and fast technique for the code you posted. Enter a 4x3 floating table fragment in the SWP editor. (Move the caption and marker fields to the front of the 4x3 tabular fields if you want the captions to typeset before the table.) Copy the entire tabular (not the table) environment. Delete the tabular 4x3 tabular input fields in the SWP editor and paste the code you copied into a tex field located in the position of the deleted tabular fields. Do not encapsulate this field. Close the document and then re-open it. Use copy and past to update the caption. Add the \def command to the B tex field on a new line after the begin{figure} line. While in this field you can change [tbp] to [htbp].