[Tex/LaTex] Left align after \specialcell in a centered table

horizontal alignmentlyxtables

I'm outputting descriptive tables from Stata using estpost and esttab into TeX format, and then importing them in LyX. I use \refcat to label my survey questions, and since some of them are very long I need to put linebreaks using \specialcell (I already do this in Stata). However, these seem to center automatically, which turns out ugly. Can I adjust my Stata code to have my labels (\refcats) align left?

This is my Stata code (updated after comment):

local opin_padres P64_rev_1_lf-P65_rev_5_lf P74_rev_1_lf-P75_rev_5_lf

estpost su `opin_padres' if tratamiento==0
est store P1

estpost su `opin_padres' if tratamiento==1
est store P2

estpost su `opin_padres' 
est store P3

esttab P1 P2 P3 using `opinpadres', replace longtable booktabs addnotes(Todos las variables han sido ponderadas en porcentajes (\%)) ///
    refcat(P64_rev_1_lf "\multicolumn{4}{\textbf{El rendimiento de los alumnos depende en gran parte de su\\situaci\'on familiar}}\\" ///
    P65_rev_1_lf "\multicolumn{4}{\textbf{La educaci\'on es una prioridad para los\\padres de los alumnos de su secci\'on}}\\" ///
    P74_rev_1_lf "\multicolumn{4}{\textbf{C\'omo es su relaci\'on con los padres de alumnos?}}\\" ///
    P75_rev_1_lf "\multicolumn{4}{\textbf{C\'omo es su relaci\'on con la comunidad en la que se encuentra la escuela?}}\\", nolabel) ///
    mtitle("Control" "Tratamiento" "\textbf{Total}") cells(mean(fmt(1))) label nonum collabels(none) noobs

And this the TeX code of the table:

{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{longtable}{l*{3}{c}}
\toprule\endfirsthead\midrule\endhead\midrule\endfoot\endlastfoot
                &\multicolumn{1}{c}{Control}&\multicolumn{1}{c}   {Tratamiento}&\multicolumn{1}{c}{\textbf{Total}}\\
\midrule
\multicolumn{4}{\textbf{El rendimiento de los alumnos depende en gran parte de su\\situaci\'on familiar}}&            &            &            \\
\hspace{0.2cm}Muy de acuerdo&        39.1&        34.3&        36.6\\
\hspace{0.2cm}De acuerdo&        51.6&        50.7&        51.1\\
\hspace{0.2cm}Indiferente&         0.0&         4.5&         2.3\\
\hspace{0.2cm}En desacuerdo&         9.4&        10.4&         9.9\\
\hspace{0.2cm}Muy en desacuerdo&         0.0&         0.0&         0.0\\
\multicolumn{4}{\textbf{La educaci\'on es una prioridad para los\\padres de los alumnos de su secci\'on}}&            &            &            \\
\hspace{0.2cm}Muy de acuerdo&        18.8&        10.4&        14.5\\
\hspace{0.2cm}De acuerdo&        45.3&        50.7&        48.1\\
\hspace{0.2cm}Indiferente&        18.8&        22.4&        20.6\\
\hspace{0.2cm}En desacuerdo&        12.5&        11.9&        12.2\\
\hspace{0.2cm}Muy en desacuerdo&         4.7&         4.5&         4.6\\
\multicolumn{4}{\textbf{C\'omo es su relaci\'on con los padres de alumnos?}}&            &            &            \\
\hspace{0.2cm}Muy buena&        31.2&        21.5&        26.4\\
\hspace{0.2cm}Buena &        54.7&        69.2&        62.0\\
\hspace{0.2cm}Regular&        14.1&         9.2&        11.6\\
\hspace{0.2cm}Mala  &         0.0&         0.0&         0.0\\
\hspace{0.2cm}Muy mala&         0.0&         0.0&         0.0\\
\multicolumn{4}{\textbf{C\'omo es su relaci\'on con la comunidad en la que se encuentra la escuela?}}\\&            &            &            \\
\hspace{0.2cm}Muy buena&        23.4&        10.9&        17.2\\
\hspace{0.2cm}Buena &        68.8&        79.7&        74.2\\
\hspace{0.2cm}Regular&         7.8&         9.4&         8.6\\
\hspace{0.2cm}Mala  &         0.0&         0.0&         0.0\\
\hspace{0.2cm}Muy mala&         0.0&         0.0&         0.0\\
\bottomrule
\multicolumn{4}{l}{\footnotesize Todos las variables han sido ponderadas en porcentajes (\%)}\\
\end{longtable}
}

This is the latest version of my preamble:

% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{threeparttablex}% For Notes below table
\usepackage{longtable}%Long tables

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

\usepackage{siunitx}
\sisetup{
    detect-mode,
    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
\def\yyy{%
\bgroup\uccode`\~\expandafter`\string-%
\uppercase{\egroup\edef~{\noexpand\text{\llap{\textendash}\relax}}}%
\mathcode\expandafter`\string-"8000 }

\def\xxxl#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\llap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\xxxr#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\rlap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\textsymbols{\xxxl[\xxxr]\xxxl(\xxxr)\yyy}


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

\newcommand{\estwide}[3]{
    \vspace{.75ex}{
        \textsymbols% Note the added command here
        \begin{tabular*}
        {\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
        \toprule
        \estinput{#1}
        \bottomrule
        \addlinespace[.75ex]
        \end{tabular*}
        }
    }   

\newcommand{\estauto}[3]{
    \vspace{.75ex}{
        \textsymbols% Note the added command here
        \begin{tabular}{l*{#2}{#3}}
        \toprule
        \estinput{#1}
        \bottomrule
        \addlinespace[.75ex]
        \end{tabular}
        }
    }

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}
                   %%%
}

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
% The new approach using threeparttables to generate notes that are the exact width of the table.
\newcommand{\Figtext}[1]{%
\begin{tablenotes}[para,flushleft]
\hspace{6pt}
\hangindent=1.75em
#1
\end{tablenotes}
}
\newcommand{\Fignote}[1]{\Figtext{\emph{Note:~}~#1}}
\newcommand{\Figsource}[1]{\Figtext{\emph{Source:~}~#1}}
\newcommand{\Starnote}{\Figtext{\textit{* p < 0.1, ** p < 0.05, *** p < 0.01.}\\  Errores est\'andares corregidos por correlaci\'on y heteroskedasticidad a nivel de escuela entre par\'entesis.}}% Add significance note with \starnote

Best Answer

Your command

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}
}

defines centred entries, you can change it to define left aligned

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}% missing % in original
                       %%%
}

Rather than force things into the first column you could replace

\textbf{\specialcell{C\'omo es su relaci\'on con la comunidad\\en la que se encuentra la escuela?}}&            &            &            \\

by

\multicolumn{4}{\textbf{\specialcell{C\'omo es su relaci\'on con la comunidad\\en la que se encuentra la escuela?}}\\

If your generator can make spanning entries?