Dear Statalist,

I have a rather technical question regarding displaying estimation commands. I am writing a command that fits a model and also computes the robust standard errors. Unfortunately, I am using my own Mata routine to compute robust standard errors, mainly because my model is fitted using an ml -d0- evaluator and those evaluators do not provide score functions. Later, I invoke -eretun repost- to replace the original variance-covariance matrix with the robust one. The problem is that when doing so, I don't know how to change the title of the Std. Err. on the display to include the Robust. label. Below is a simple routine that exemplifies my question.
  1. Ado file MyReg.ado
Code:
program MyReg 
    version 12
    if replay() {
    if ("`e(cmd)'" != "MyReg") error 301
    Replay `0'
    }
    else Estimate `0'
end


program Estimate, eclass sortpreserve 
    syntax varlist(fv) [if] [in] , [Robust]

    // check syntax
    gettoken lhs rhs : varlist
    qui reg `lhs' `rhs'

    tempname b V
    matrix `b' = e(b)
    matrix `V' = e(V)

    // "Fake" Sandwich Matrix, just for illustration. 
    mata: V_r = st_matrix("`V'") + J(cols(st_matrix("`V'")), rows(st_matrix("`V'")),100)
    mata: st_matrix("V_r", V_r)

    if "`robust'" !="" {
        ereturn repost b=`b' V=V_r , rename
        ereturn display             
    }
    else ereturn display          
end
2.- Do file that invoked MyReg.ado

Code:
. sysuse auto, clear
(1978 Automobile Data)

. MyReg price mpg 
------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
       _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
------------------------------------------------------------------------------


. MyReg price mpg , r
------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -238.8943   54.01051    -4.42   0.000    -346.5623   -131.2264
       _cons |   11253.06   1170.855     9.61   0.000     8919.003    13587.12
------------------------------------------------------------------------------
3.-What I want to be displayed is
Code:
. 
. MyReg price mpg , r

------------------------------------------------------------------------------
             |               Robust
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -238.8943   54.01051    -4.42   0.000    -346.5623   -131.2264
       _cons |   11253.06   1170.855     9.61   0.000     8919.003    13587.12
------------------------------------------------------------------------------

Finally, headers are not an issue because I am writing my own. In fact, in the header, I already wrote a message telling the user that robust standard errors were computed, but I need to confess that the lack of the word Robust at the top makes my eye twitch a bit...

Thanks you a lot for your time.

Álvaro
Stata 16.1 MP
Win10/Linux Mint 19.1
https://alvarogutyerrez.github.io/