[Tex/LaTex] Error: Not in outer par mode with estwide table


I am new to using TeX. I am trying to call a table as a tex file that is created in Stata 14. I am using estwide command. But I am getting an error message " Not in outer par mode" .
I checked the previously posted questions and answers about it, however the changes didn't correct the error.
I am attaching my codes and the tex file. Note that I have tex codes for the table that Stata created in tex form. When I copy and paste that tex, there is no error. The table is compiled. However, I am trying to automize adding tables and figures in TeX file. I am using OS X El Capitan v.10.11.4.
Any help would be appreciated! I couldn't upload the tex file that I want to add. But it is in the code "comment"ed.
E. Watson


\usepackage[total={6in,9in}, top=1.0in, bottom=1.0in, left=1.25in, right=1.25in, includefoot]{geometry}


% Alter some LaTeX defaults for better treatment of figures:
    % See p.105 of "TeX Unbound" for suggested values.
    % See pp. 199-200 of Lamport's "LaTeX" book for details.
    %   General parameters, for ALL pages:
    \renewcommand{\topfraction}{0.9}    % max fraction of floats at top
    \renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
    %   Parameters for TEXT pages (not float pages):
    \setcounter{totalnumber}{4}     % 2 may work better
    \setcounter{dbltopnumber}{2}    % for 2-column pages
    \renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
    \renewcommand{\textfraction}{0.07}  % allow minimal text w. figs
    %   Parameters for FLOAT pages (not text pages):
    \renewcommand{\floatpagefraction}{0.7}  % require fuller float pages
    % N.B.: floatpagefraction MUST be less than topfraction !!
    \renewcommand{\dblfloatpagefraction}{0.7}   % require fuller float pages


%%%%%% NEW PRE %%%%%
% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{threeparttablex}% For Notes below table

% *****************************************************************
% siunitx
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}} % Thanks to Joseph Wright & David Carlisle

        group-digits            = false,
        input-symbols           = ( ) [ ] - +,
        table-align-text-post   = false,
        input-signs             = ,

% Character substitution that prints brackets and the minus symbol in text mode. Thanks to David Carlisle
  \mathcode\expandafter`\string-"8000 }

\mathcode\expandafter`\string#1"8000 }

\mathcode\expandafter`\string#1"8000 }


% *****************************************************************
% Estout related things
% *****************************************************************
\let\estinput=\input % define a new input command so that we can still flatten the document

            \textsymbols% Note the added command here

            \textsymbols% Note the added command here

% Allow line breaks with \\ in specialcells

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
% The new approach using threeparttables to generate notes that are the exact width of the table.
\newcommand{\Starnote}{\Figtext{* p < 0.1, ** p < 0.05, *** p < 0.01. Standard errors in parentheses.}}% Add significance note with \starnote


%%%%%% TABLES %%%%%


%%% This part pasted from tex file stata created. 
%%  It compiles without error.
%\caption{Regression table\label{tab1}}
%                    &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
%                    &\multicolumn{1}{c}{Price}&\multicolumn{1}{c}{Price}\\
%Weight (lbs.)       &       1.747&       3.465\\
%                    &      (2.72)&      (5.49)\\
%Mileage (mpg)       &      -49.51&       21.85\\
%                    &     (-0.57)&      (0.29)\\
%Car type            &            &      3673.1\\
%                    &            &      (5.37)\\
%Constant            &      1946.1&     -5853.7\\
%                    &      (0.54)&     (-1.73)\\
%Observations        &          74&          74\\
%\multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\


Best Answer

Not in outer par mode means you have a table environment nested inside something that doesn't allow tables. Here it is another table environment.

Your input file starts

\caption{Regression table\label{tab1}}

so it is already a complete table float with a caption, not just the table itself.

But you are trying to input it as


so putting a table inside a threeparttable inside a table. That can not work, just use


or (if that's possible) get your application to just write the inner tabular to the table1.tex file not wrap it in table and \caption