Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Create a table with signs of estimated coefficients

From   "Austin Nichols" <>
Subject   Re: st: Re: Create a table with signs of estimated coefficients
Date   Thu, 8 Mar 2007 10:54:26 -0500

read -help macro- and -help matrix- and linked help files, then check
out -help foreach- and -help file-.  -help program- can help you
automate your tables.  Here is an example of what you might want:

sysuse auto
reg pr mpg wei for
mat b1=e(b)
mat v1=e(V)
local df1=e(df_r)
sysuse cancer
reg died age
mat b2=e(b)
mat v2=e(V)
local df2=e(df_r)

local order "age mpg weight foreign _cons"
file close _all
file open t using /t.txt, write replace
file write t _tab "auto" _tab "cancer"
file write t _n _tab "(price)" _tab "(died)"
foreach v of local order {
file write t _n "`v'"
forv i=1/2 {
file write t _tab
local b=b`i'[1,colnumb(b`i',"`v'")]
local plus=cond(`b'>0,"+","-")
if `b'<. file write t "`plus'"
local s=sqrt(v`i'[colnumb(b`i',"`v'"),colnumb(b`i',"`v'")])
local t= b`i'[1,colnumb(b`i',"`v'")]/`s'
local p=ttail(`t',`df`i'')
if `b'<. &(`t'==. | `p'<.05) file write t "`plus'"
file close _all
type /t.txt

On 3/8/07, Sergiy Radyakin <> wrote:
Method 1 involves headacke, and is not readily automated
Method 2 requires some more programming effort but simultaneously gives you
full control.
Method 3:
1) wait for other suggestions...

----- Original Message -----
From: "Nikolaos Kanellopoulos" <>
> Dear all,
> I am estimating the same model in different datasets (the names of the
> variables used are the same in all datasets).
> I want to create a table with the sign of estimated coefficients and if
> possible have a double sign if the coefficient is significant.
*   For searches and help try:

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