*! Help file for cleancmdline.ado version 1.1 written by Mead Over (mover@cgdev.org) 31Jan2019

Title

cleancmdline -- Extract the commmand line from previously
issued estimation command

Syntax

cleancmdline
,
[options]

Options

Required option
cmdline(string) User provides the previous command line. If the
estimation results from the previous estimation remain in mmemory,
the user could specify cmdline("`e(cmdline)'").

Optional option
newdepvar Specifying the option newdepvar
directs the program to proceed despite the dependent variable
not being in Stata's memory.

Description

This program accepts as input the command line returned by a Stata estimation
command and then strips it of the estimation command at the beginning and of the if,
in and weights modifiers at the enda simplified command line which
begins with the dependent variable. For a multiequaiton command like
-sureg- or -reg3-, this program strips e(cmdline) of the estimation command,
the equation name (identified because it is followed by a colon) and all
parentheses.

Examples

To run these example, you must have already installed flexmake
on the same computer.
First, in order to get the data and compute the logarithms
of the cost and factor prices:

click here

<output omitted>

Estimate a Cobb-Douhgglas cost function.

click here

<output omitted>

After regress, Stata returns the cleaned command line in the local macro e(cmdline).
Executing cleancmdline after regress only removes the name of the estimation commmand and any
if, in or options.

click here

<output omitted>

Now estimate a multiequation model.

click here

<output omitted>

Executing cleancmdline on the e(cmdline) returned by
the estimation command strips away everything
except the variable list for the first equation.

click here

<output omitted>

Now estimate a model with an instrumental variables method.

click here

<output omitted>

Again, executing cleancmdline on the e(cmdline) returned by
the estimation command strips away everything
except the variable list for the first equation.

click here

<output omitted>

Returned results

macros:
r(depvar) Dependent variable

r(eqname) For multiequation models, the name of the first equation

r(estcmd) The estimation commmand

r(ivmethod) If the estimation command is ivregress, the IV method

r(origcmdline) The original command line provided to this program
in the option cmdline(string)

r(cmdline) The cleaned version of the original command line

Authors

Mead Over at:
Email: MOver@CGDev.Org if you observe any
problems.