Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

AW: st: AW: -outreg2- super-rows and super-columns


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: -outreg2- super-rows and super-columns
Date   Thu, 15 Apr 2010 11:05:19 +0200

<> 

Admittedly, the official "Example 8" in -help outreg2- does lead to the
error, w/o running anything "twice":



*************
sysuse auto, clear
reg mpg rep78 head weight turn disp gear
outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2) see
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Kelvin Tan
Gesendet: Donnerstag, 15. April 2010 10:56
An: [email protected]
Betreff: Re: st: AW: -outreg2- super-rows and super-columns

Thanks Abdel,

It did produce an output, but the output did not do the trick of
super-row. Please look below. Thanks

	(1)
VARIABLES	mpg
	
rep78	0.441
	(0.513)
headroom	-0.163
	(0.584)
weight	-0.00549***
	(0.00174)
turn	-0.154
	(0.203)
displacement	0.00884
	(0.0145)
gear_ratio	0.833
	(1.733)
Constant	38.83***
	(9.358)
	
Observations	69
R-squared	0.662
Standard errors in parentheses	
*** p<0.01, ** p<0.05, * p<0.1	



Re: Martin's code, I know that -outreg2- can append second regression
results next to the first results. However, I would like to know if it
is possible to create a hypotheses column before the first results
with some codes look like

labcol2(+ ? + -, title("" Hypothesis))


Thanks,
Kelvin

On Thu, Apr 15, 2010 at 6:44 PM, Abdel Rahmen El Lahga
<[email protected]> wrote:
> The problem is when you call outreg twice without runing new
> regression the error occurs. Try the code below
> cap erase myfile.txt
> di in r _rc
> sysuse auto, clear
> reg mpg rep78 head weight turn disp gear
> outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2)
> outreg2 using myfile_bis, groupvar(Group1 trunk turn head weight Group2)
> outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2)
>
>
>
> 2010/4/15 Martin Weiss <[email protected]>:
>>
>> <>
>>
>> Actually, -outreg2- happily appends columns to its output file, so I am
not
>> sure this is the problem:
>>
>>
>> *************
>> cap erase myfile.txt
>> di in r _rc
>> sysuse auto, clear
>> reg price weight length
>> outreg2 using myfile
>> reg price length rep78 turn
>> outreg2 using myfile
>> seeout using "myfile.txt"
>> *************
>>
>>
>>
>> HTH
>> Martin
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Abdel Rahmen
El
>> Lahga
>> Gesendet: Donnerstag, 15. April 2010 10:29
>> An: [email protected]
>> Betreff: Re: st: AW: -outreg2- super-rows and super-columns
>>
>> The erro is caused by the already existing file 'myfile'. You should
>> either add option replace to your code
>> outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2) see
>> replace
>> or you could change the name of using file like
>> outreg2 using myfile_bis, groupvar(Group1 trunk turn head weight Group2)
see
>> HTH
>> AbdelRahmen
>>
>> 2010/4/15 Kelvin Tan <[email protected]>:
>>> Hi Martin,
>>>
>>> Thanks for your prompt reply. I don't know why it the code below could
>>> not run on my machine. I set trace on, here is the error message
>>> (scroll down to see the error message) .
>>>
>>> Re: super-column example with -estout- is excellent. However, I was
>>> wondering if this function could be incorporated into -outreg2-. Or
>>> how can I use a combination of both -estout- and -outreg2- to produce
>>> a latex format table with hypotheses column? The reason that I stick
>>> with -outreg2- because I have spent a huge amount of time to "modify"
>>> the code to suit the latex format that I want.
>>>
>>> Many Thanks,
>>> Kelvin
>>>
>>>
>>>
>>>
>>>
>>
 ---------------------------------------------------------------------------
>> ---------------------------
>>> end egen ---
>>>    - replace Vorder1=-99 if Vorder1==min
>>>    - drop min
>>>    - gen varnum = Vorder1 if Vorder1<1
>>>    - replace Vorder1=3.7 if rowtype1>=2
>>>    - replace Vorder1=Vorder1[_n-1]+.0001 if Vorder1>=3.7 & rowtype1==3
>>>    - replace Vorder1=2 if rowtype1==2
>>>    - replace Vorder1=3.5 if v1=="Observations"
>>>    - replace Vorder1=3.6 if v1=="R-squared"
>>>    - replace Vorder1=1 if Vorder1==. & (Vorder1[_n-1]<1 |
>> Vorder1[_n-1]==1)
>>>    - replace Vorder1=4 if v2=="" & v2plus=="" & Vorder1>3.5
>>>    - gen Vorder1_0=.
>>>    - local maxnum 1
>>>    - if "`sortvar'"~="" {
>>>    = if ""~="" {
>>>      tokenize `sortvar'
>>>      local num 1
>>>      while "``num''"~="" {
>>>      replace Vorder1_0=`num' if v1=="``num''" | VarName1=="``num''" &
>>> Vorder1==1
>>>      local num=`num'+1
>>>      }
>>>      if `num'>`maxnum' {
>>>      local maxnum `num'
>>>      }
>>>      }
>>>    - if "`groupvar'"~="" {
>>>    = if "Group1 trunk turn headroom weight Group2"~="" {
>>>    - count if v1~="" & rowtype1==1
>>>    - local nom `r(N)'
>>>    = local nom 3
>>>    - count if rowtype1==1
>>>    - if `nom'~=0 {
>>>    = if 3~=0 {
>>>    - local many=int(round(`r(N)'/`nom'),1)
>>>    = local many=int(round(6/3),1)
>>>    - }
>>>    - else {
>>>      local many 2
>>>      }
>>>    - tab eqName if rowtype1==1
>>>    - local rr=`r(r)'
>>>    = local rr=0
>>>    - local tempList
>>>    - local orderlist
>>>    - if `rr'> 0 {
>>>    = if 0> 0 {
>>>      gen str5 temp=""
>>>      replace temp=eqName if eqName~=eqName[_n-1] & rowtype1==1
>>>      sort temp
>>>      local N=_N
>>>      forval num=1/`rr' {
>>>      local content=temp[`N'-`num'+1]
>>>      local tempList="`tempList' `content'"
>>>      local content=eq_order1[`N'-`num'+1]
>>>      local orderlist="`orderlist' `content'"
>>>      }
>>>      drop temp
>>>      sort Vord1
>>>      local times `rr'
>>>      }
>>>    - else {
>>>    - local times 1
>>>    - }
>>>    - tokenize `groupvar'
>>>    = tokenize Group1 trunk turn headroom weight Group2
>>>    - forval kk=1/`times' {
>>>    = forval kk=1/1 {
>>>    - local order: word `kk' of `orderlist'
>>>    = local order: word 1 of
>>>    - local temp: word `kk' of `tempList'
>>>    = local temp: word 1 of
>>>    - local num 1
>>>    - local count0 0
>>>    - while "``num''"~="" {
>>>    = while "Group1"~="" {
>>>    - replace Vorder1_0=`num' if (v1=="``num''" | VarName1=="``num''"
>>> ) & eqName=="`temp'"
>>>    = replace Vorder1_0=1 if (v1=="Group1" | VarName1=="Group1" ) &
>> eqName==""
>>>    - count if Vorder1_0~=. & eqName=="`temp'"
>>>    = count if Vorder1_0~=. & eqName==""
>>>    - if `r(N)'==`count0' {
>>>    = if 0==0 {
>>>    - forval cc=1/`many' {
>>>    = forval cc=1/2 {
>>>    - local N=_N
>>>    - set obs `=`N'+1'
>>>    = set obs 17
>>>    - local N=_N
>>>    - if `cc'==1 {
>>>    = if 1==1 {
>>>    - replace v1="``num''" in `N'
>>>    = replace v1="Group1" in 17
>>>    - }
>>>    - replace varname="``num''" in `N'
>>>    = replace varname="Group1" in 17
>>> variable varname not found    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  ERROR
>>> MESSAGE HERE <<<<<<<<<<
>>>      replace rowtype1=1 in `N'
>>>      replace Vorder1=1 in `N'
>>>      replace Vorder1_0=`num' in `N'
>>>      if `rr'>0 {
>>>      if `cc'==1 {
>>>      replace v1="`temp':" + v1 in `N'
>>>      }
>>>      replace eq_order1=`order' in `N'
>>>      replace eqName="`temp'" in `N'
>>>      }
>>>      }
>>>      }
>>>      count if Vorder1_0~=. & eqName=="`temp'"
>>>      local count0 `r(N)'
>>>      local num=`num'+1
>>>      }
>>>      while "``num''"~="" {
>>>      replace Vorder1_0=`num' if (v1=="``num''" | VarName1=="``num''"
>>> ) & eqName=="`temp'"
>>>      count if Vorder1_0~=. & eqName=="`temp'"
>>>      if `r(N)'==`count0' {
>>>      forval cc=1/`many' {
>>>      local N=_N
>>>      set obs `=`N'+1'
>>>      local N=_N
>>>      if `cc'==1 {
>>>      replace v1="``num''" in `N'
>>>      }
>>>      replace varname="``num''" in `N'
>>>      replace rowtype1=1 in `N'
>>>      replace Vorder1=1 in `N'
>>>      replace Vorder1_0=`num' in `N'
>>>      if `rr'>0 {
>>>      if `cc'==1 {
>>>      replace v1="`temp':" + v1 in `N'
>>>      }
>>>      replace eq_order1=`order' in `N'
>>>      replace eqName="`temp'" in `N'
>>>      }
>>>      }
>>>      }
>>>      count if Vorder1_0~=. & eqName=="`temp'"
>>>      local count0 `r(N)'
>>>      local num=`num'+1
>>>      }
>>>      if `num'>`maxnum' {
>>>      local maxnum `num'
>>>      }
>>>      }
>>>      }
>>>    --------------
>>>
>>>
>>> On Thu, Apr 15, 2010 at 5:25 PM, Martin Weiss <[email protected]>
>> wrote:
>>>>
>>>> <>
>>>>
>>>> For the hypotheses column, try
>>>> http://repec.org/bocode/e/estout/advanced.html#advanced005
>>>>
>>>>
>>>> Your code runs without problems for me. -set trace on- and see where
the
>>>> error occurs.
>>>>
>>>>
>>>>
>>>> HTH
>>>> Martin
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: [email protected]
>>>> [mailto:[email protected]] Im Auftrag von Kelvin Tan
>>>> Gesendet: Donnerstag, 15. April 2010 09:11
>>>> An: [email protected]
>>>> Betreff: st: -outreg2- super-rows and super-columns
>>>>
>>>> Hi All,
>>>>
>>>> I follow the helpfile from -outreg2- to create a supper-row, but I
>>>> obtained the following error message. Can anyone give me some advice
>>>> on this?
>>>>
>>>> variable varname not found
>>>> r(111);
>>>>
>>>> ---- Begin Code ----
>>>> sysuse auto, clear
>>>> reg mpg rep78 head weight turn disp gear
>>>> outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2)
see
>>>> --- End Code ----
>>>>
>>>>
>>>> Is it possible to create a "super-column" - a empty column? or is it
>>>> possible to create a "predicted sign column" (see below) with outreg2
>>>> in stata, then covert it into a Latex format? I need this predicted
>>>> column because it is very hard to create a column in a Latex table.
>>>>
>>>>
>>>> Variable |Predicted Sign| Coefficients
>>>> trunk  (+)       -0.316**
>>>>                 (0.134)
>>>> turn       (-)      -0.761***
>>>>                  (0.131)
>>>> Constant          55.82***
>>>>                 (4.354)
>>>>
>>>> Observations    74
>>>> R-squared       0.552
>>>>
>>>> Regards,
>>>> Kelvin
>>>> *
>>>> *   For searches and help try:
>>>> *   http://www.stata.com/help.cgi?search
>>>> *   http://www.stata.com/support/statalist/faq
>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>>
>>>>
>>>> *
>>>> *   For searches and help try:
>>>> *   http://www.stata.com/help.cgi?search
>>>> *   http://www.stata.com/support/statalist/faq
>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>>
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>
>>
>>
>> --
>> AbdelRahmen El Lahga
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
>
>
> --
> AbdelRahmen El Lahga
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index