EDIT: Added preamble, and it seems \input table worked! When I manually insert the table, rather than input it, I do not get any errors, and it looks nice. However, when I use \input{table.tex}, I get a host of errors and the PDF won't compile - Misplaced \noalign, Missing } inserted, Missing } inserted, Misplaced \cr, Misplaced \cr. I don't have the problem for \toprule, and I do use the packages siunitx and booktabs.
Here is the code to generate the table:
\documentclass[11pt]{article}
%% links
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
%% maths
\usepackage{amssymb, amsfonts, amsmath}
\usepackage{bm}
%% basic layout formatting
\usepackage[margin=1in]{geometry} % full-width
\topskip = 20pt
\parskip = 10pt
\parindent = 0 pt
\baselineskip = 15pt
\usepackage{setspace} % line spacing
\onehalfspacing
\usepackage{graphicx}\usepackage{siunitx}
\usepackage{adjustbox}
\usepackage{caption} % to reset the headers of tables
\usepackage{rotating} % for sidewaystable
\usepackage{siunitx}
\numberwithin{table}{section} % reset the Table numbering for each section
%% these three are essential for estout
\usepackage{booktabs} % neatly formatting lines
\usepackage{threeparttable}
\usepackage{dcolumn} % aligning decimals
\newcolumntype{d}[1]{D{.}{.}{#1}}
%% bibliography
\usepackage{natbib}
\bibliographystyle{plainnat}
\begin{document}
%%%% TABLE 1 %%%%
\begin{table}[!htbp]
\caption{Summary statistics} \label{tab:table1}
\begin{tabular}{lrrrr}
\toprule
\input{table.tex}
\bottomrule
\end{tabular}
\end{table}
\end{document}
Here is my table.tex code:
& N& Mean& SD\\
\midrule
w & 1& 5& 9\\
x & 2& 6& 10\\
y & 3& 7& 11\\
z & 4& 8& 12\\

MWEfrom\documentclassto\end{document}– MadyYuvi Nov 01 '21 at 13:03\input{table.tex}to\input tableseems to take care of the problem. – Mico Nov 01 '21 at 13:17