I am following the answer by dapperdan to get regression results from Stata in Latex (using the command estout) and from there to LyX. Everything works but I wanted to have thousands separated by a comma. For this I changed the sisetup to
\sisetup{
detect-mode,
group-digits = true,
group-separator = {,},
input-symbols = ( ) [ ] - +,
table-align-text-post = false,
input-signs = ,
}
Everything looks good except for the number is the parentheses (standard errors). They get an additional comma at the end as can be seen in the pic below:
Clearly, this is not what I want. So something in my setup must be wrong.
A MWE is given here. It is made up of the main part (1) and the tex table fragment (2).
(1) Main tex file
%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% *****************************************************************
% 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
\usepackage{siunitx}
\sisetup{
detect-mode,
group-digits = true,
group-separator = {,},
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]{@{}c@{}}#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{* p < 0.1, ** p < 0.05, *** p < 0.01. Standard errors in parentheses.}}% Add significance note with \starnote
\makeatother
\usepackage{babel}
\begin{document}
\begin{table}
\caption{First Table}
\begin{threeparttable}
\estwide{Fra_Table.tex}{3}{S[table-format=2.3]} %% Table Fragment is called here %%
\Fignote{Some Notes}
\Figsource{Own calculations based on data}
% \Starnote
\end{threeparttable}
\end{table}
\end{document}
(2) The table fragment "Fra_Table.tex" called by the newcommand estwide near the end of the above MWE is given below (save in the same folder as you compile the above stuff):
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)} \\
\midrule
2\textsuperscript{nd} stage \\
\midrule
Effect & -0.100 & -1.000 & 0.050 \\
& (2.871) & (3.843) & (2.311) \\
\addlinespace
Observations &\multicolumn{1}{S[table-format=5]}{50000} &\multicolumn{1}{S[table-format=5]}{50000} &\multicolumn{1}{S[table-format=5]}{50000} \\