Dealing with Data / Data formats / FORMAT=TEX |
TeX is a table-oriented text format for output (only) which renders the contents as a TeX tabular environment. You can apply it to data series and reports. It’s available on all versions of RATS.
RATS Instructions
copy(format=tex) |
write series to TeX file |
prtdata(format=tex) |
write series from RATS format file to TeX |
write(format=tex) |
write scalars or arrays from memory to TeX file |
report(format=tex) |
(with ACTION=FORMAT) write a report to TeX file |
Interface Operations
Series Window and RATS Data File Window
You can export series using File—Export..., the toolbar button, or the Export operation on the contextual menu.
Report Windows
You can write reports to a TeX file using File—Save As, File—Export, Edit—Copy as TeX, the ,
and
toolbar items, and the Export and Copy->TeX contextual menu operations.
Matrix Windows
You can write the contents of a matrix window to a TeX file using File—Save As, File—Export, Edit—Copy as TeX, the ,
and
, and the Export and Copy->TeX contextual menu items.
Details
To use the TeX table in a document, you need to include the dcolumn package, which allows for decimal alignment of columns. This is an example of what is produced:
\newcolumntype{.}{D{.}{.}{-1}}
\begin{tabular}{. . . }
\multicolumn{1}{c}{Test} & \multicolumn{1}{c}{Statistic} &
\multicolumn{1}{c}{P-Value} \\\\
\multicolumn{1}{l}{Joint} & \multicolumn{1}{r}{4.070} &
\multicolumn{1}{r}{0.000} \\\\
\multicolumn{1}{l}{Variance} & \multicolumn{1}{r}{0.121} &
\multicolumn{1}{r}{0.473} \\\\
\multicolumn{1}{l}{Constant} & \multicolumn{1}{r}{0.922} &
\multicolumn{1}{r}{0.004} \\\\
\multicolumn{1}{l}{X2} & \multicolumn{1}{r}{0.917} &
\multicolumn{1}{r}{0.004} \\\\
\multicolumn{1}{l}{X3} & \multicolumn{1}{r}{0.914} &
\multicolumn{1}{r}{0.004} \\\\
\end{tabular}
Note that if you want to paste the table into a TeX document, you need to use one of the Copy as TeX operations. The standard Copy operations also produce a straight tab-delimited text copy of the data, which will generally be the one chosen by the Paste operation in the target application. Copy as TeX puts only the TeX version into the clipboard.
You will generally enclose the tabular environment produced by RATS inside a table environment which will handle the placement and captioning. If the TeX code on the previous page is saved in the file testtable.tex, the following would center it on the page with the caption “Example of tex Output”.
\begin{table}[htb]
\centering
\include{testtable}
\caption{Example of TeX Output}
\end{table}
TeX formatting codes
In general, the export procedure will escape any character which would be interpreted as a TeX format code. For instance, the lag notation Y{1}, Y{2} and Y{3} out of a standard regression output will appear as they would in RATS output, as the { and } get escaped to prevent the standard TeX interpretation.
\newcolumntype{.}{D{.}{.}{-1}}
\begin{tabular}{. . . }
\multicolumn{2}{l}{Constant} & \multicolumn{1}{r}{0.0976} \\\\
\multicolumn{2}{l}{Y\{1\}} & \multicolumn{1}{r}{0.1356} \\\\
\multicolumn{2}{l}{Y\{2\}} & \multicolumn{1}{r}{0.1769} \\\\
\multicolumn{2}{l}{Y\{3\}} & \multicolumn{1}{r}{0.1457} \\\\
\end{tabular}
If you want to include special formatting codes, you can edit the information after you’ve included in your final document. If you want to eliminate that step, you can enclose a string (inside the quotes) with $ characters when you built a REPORT. For instance, the following will use \(\phi_1\), \(\phi_2\) and \(\phi_3\) for the three lag coefficients.
report(action=define)
report(atrow=1,atcol=1) "1" %beta(1) %stderrs(1)
report(atrow=2,atcol=1) "$\phi _1$" %beta(2) %stderrs(2)
report(atrow=3,atcol=1) "$\phi _2$" %beta(3) %stderrs(3)
report(atrow=4,atcol=1) "$\phi _3$" %beta(4) %stderrs(4)
report(action=format,picture="*.####")
open texfile "regoutput.tex"
report(action=show,format=tex,unit=texfile)
Copyright © 2025 Thomas A. Doan