[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Using xml_tab

From   "Zurab Sajaia" <>
To   <>
Subject   st: Re: Using xml_tab
Date   Mon, 2 Mar 2009 15:45:42 -0500

Hi Alan,

To see variable names instead of (default) labels, you can use -nolabel- option; -xml_tab- can also output matrices directly, so you can accumulate your betas into a matrix and then use xml_tab:

(from your example):
regress mpg weight
matrix A = e(b)'
regress mpg weight foreign displacement
matrix B = e(b)'

xml_tab A B, {options}

when exporting a matrix, -xml_tab- reads matrix rownames (and row equations if present), so to modify text in the rows you can either form the names for your matrix, i.e. matrix rownames A = "this is row 1" "and row 2" (for the third row "displacement" will remain as the name)

or use -xml_tab-'s option rnames():
xml_tab A B, rnames("this is row 1" "and row2")

when merging two matrices of different size -xml_tab- puts .z by default for the added cells (I guess I'll have to change this default), but if you want to use any other text, or blank you can specify -mv- option:

xml_tab A B, mv(.z="(missing)") // replace .z missing values with text "(missing)"
xml_tab A B, mv("") //all the missing values, not only .z will be replaced by the empty cells

Hope this helps,

----- Original Message ----- From: "Alan Neustadtl" <>
To: "Statalist" <>
Sent: Monday, March 02, 2009 2:58 PM
Subject: st: Using xml_tab

I am using version 3.50 (24Jun2008) of xml_tab from SSC and am looking
fo rhelp from more experienced users.

Is there a way to 1) only output the coefficients (and drop the std.
errors, t-statistics, and/or pvalues), 2) rename the variable names
(e.g.  "Mileage (mpg)" becomes "MPG"), and 3) add line underneath the
table title (not the first row of coefficients).

Here is a simple example where I changed "_cons" to "Constant".  While
I have played around with the lines options I have not figured out how
to do the rest.

***** START OF CODE *****
sysuse auto, clear
quietly regress mpg weight
estimates store m1
quietly regress mpg weight foreign displacement
estimates store m2

#delimit ;
xml_tab m1 m2, replace
  format((S3120) (N2304))
#delimit cr
estimates clear
*****  END OF CODE ****

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index