I am using Benn Jan's esttab command for Stata and combining the results with my draft LaTeX document, using the useful tips provided by Jörg Weber. I want to include some non-standard results in my regression table, but separate them with a line and maybe associate them with a subtitle. The do-file in Stata would be something like this:

sysuse auto, clear
reg mpg weight length i.foreign, robust 
test weight+length=0 
estadd scalar f_test=r(F)
estadd scalar ppdiff=r(p)
lincom weight+length
estadd scalar marginal=r(estimate)

est store A

esttab A using auto.tex, replace nonotes nomtitles f ///
    label booktabs b(3) alignment(S) eqlabels(none) ///
    drop(0.foreign) star(* 0.10 ** 0.05 *** 0.01) stats(marginal f_test ppdiff N r2, ///
    fmt(3 3 3 %9.0gc 3) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}") ///
    labels(`"Hypothesis test"' `"F-test"' `"p-value"' `"Observations"' `"\(R^{2}\)"'))

And the related LaTeX code:

\documentclass[12pt,A4,fleqn]{article}           % fleqn: align equations left

% Document:
\usepackage{geometry}                                     % Custom margins for single page, etc.
\usepackage{fullpage}                                     % Use the full page
\usepackage{setspace}                                     % Enables custom margins, doublespacing, etc.
\usepackage{pdflscape}                                    % Use: \begin{landscape} ... \end{landscape}

\usepackage{lscape} % To create a table in a landscape environment
\usepackage{rotating} % To use sideways table
\usepackage{rotfloat} % Use H with a sideways table

% Font/text:
\usepackage[latin9]{inputenc}                             % Font definition and input type
\usepackage[T1]{fontenc}                                  % Font output type 
\usepackage{lmodern}                                      % Latin Modern fonts
\usepackage{textcomp}                                     % Supports many additional symbols
\usepackage{amsmath}                                      % Math equations, etc.
\usepackage{amsthm}                                       % Math theorems, etc.
\usepackage{amsfonts}                                     % Math fonts (e.g. script fonts)
\usepackage{amssymb}                                      % Math symbols such as infinity
\DeclareMathOperator*{\Max}{Max}                          % Better looking max function
\DeclareMathOperator*{\Min}{Min}                          % Better looking min function
\usepackage{color}                                        % Enables colored text
\definecolor{darkblue}{rgb}{0.0,0.0,0.66}                 % Custom color: dark blue
\usepackage[hyperfootnotes=false,bookmarksopen]{hyperref} % Enable hyperlinks, expand menu subtree
\hypersetup{                                              % Custom hyperlink settings
    pdffitwindow=false,                                   % true: window fit to page when opened
    pdfstartview={XYZ null null 1.00},                    % Fits the default zoom of the page to 100%
    pdfnewwindow=true,                                    % Links in new window
    colorlinks=true,                                      % false: boxed links; true: colored links
    linkcolor=darkblue,                                   % Color of internal links
    citecolor=darkblue,                                   % Color of links to bibliography
    urlcolor=darkblue  }                                  % Color of external links
%\usepackage{kpfonts}    % for nice fonts

% Images:
\usepackage{graphicx}                                     % Allows more types of images to be included
\usepackage[position=bottom]{subfig}                      % Enables arrayed images
\usepackage[section]{placeins}                            % Forces floats to stay in section
\usepackage{float}                                        % Used with restylefloat
\restylefloat{figure}                                     % "H" forces a figure to be "exactly here"
\usepackage[justification=centering]{caption}             % Center captions

% Tables/arrays:
\usepackage{booktabs}                                    % Table format - increases table spacing
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}    % Spacing for tables increased
\renewcommand{\arraystretch}{1}                          % Spaces arrays at 1x
\usepackage{dcolumn}                                     % Align decimals in tables (as option)
%\newcolumntype{.}{D{.}{.}{-1}}                           % Align decimals e.g. \begin{tabular}{c...}

% Miscellaneous:
\interfootnotelinepenalty=10000                           % Footnotes won't break across pages
\usepackage[semicolon]{natbib}                            % Bibliography and citation formating
\usepackage{datetime}                                     % Custom date format for date field
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR}    % Defining month year date format
%\usepackage{tikz}                                        % Timelines and other drawings
%\usetikzlibrary{decorations}                             % Formating for Tikz
% *****************************************************************
% Estout related things
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}}% Thanks to David Carlisle

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



% Allow line breaks with \\ in specialcells

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
    \caption*{\hspace{6pt}\hangindent=1.5em #1}


% Add significance note with \starnote
\newcommand{\starnote}{\figtext{* p<0.1, ** p<0.05, *** p<0.01. Clustered standard errors in parentheses.}}

% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx} % centering in tables
        tight-spacing       = true,
        group-digits        = false ,
        input-signs     = ,
        input-symbols       = ( ) [ ] - + *,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        table-align-text-post   = false
% *****************************************************************
% *****************************************************************
% *****************************************************************
% *****************************************************************
% *****************************************************************
% *****************************************************************


    \caption{Auto example} 


How can I in this example insert a line between, say, "p-value" and "Observations" (by modifying the do-file only)? And if I want to insert some kind of identifier for this part of the table, how could I do that? Any suggestion is greatly appreciated.

Browse other questions tagged or ask your own question.