Statalist


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

[no subject]



On Tue, May 13, 2008 at 4:27 PM, Erasmo Giambona <[email protected]> wrote:
> Dear Austin,
> I have spent quite some time trying to understand why the code stops
> estimating d at some point. I also tried to run the code only on the
> subsample including firms with id number higher than 5918. I get an
> error message saying no observations. No success. The data however is
> there. So I am at a loss. I hope you can be a bit more patient with
> this issue. I could send you the data or a portion of the data if
> necessary.
> Hope you can provide a bit more help.
> Regards,
> Erasmo
>
> On Tue, May 13, 2008 at 12:46 PM, Erasmo Giambona <[email protected]> wrote:
>> Hi Austin,
>> This code works except that it produces missing values for d starting
>> from firm number 5918, despite the fact that y and x are availables. I
>> thought it was a memory problem, so I set the memory to 850m, but I
>> still get missing values. Does it mean that I have to run the code for
>> different subsamples?
>> Thanks.
>> Erasmo
>>
>>
>> On Fri, May 9, 2008 at 2:04 PM, Austin Nichols <[email protected]> wrote:
>> > Erasmo--this problem seems constantly to have a "new" wrinkle.  Try this:
>> >
>> > clear
>> > input firm year y x
>> >      1 1980 20 23
>> >      1 1981 22 34
>> >      1 1982 20 19
>> >      1 1984 22 34
>> >      1 1985 20 19
>> >      1 1986 28 34
>> >      1 1987 30 19
>> >      1 2004 33 48
>> >      1 2005 30 45
>> >      1 2006 35 50
>> >      2 1980 15 23
>> >      2 1981 55 34
>> >      2 1982 29 19
>> >      2 1983 15 23
>> >      2 1984 55 34
>> >      2 1985 29 19
>> >      2 1986 28 34
>> >      2 1987 30 19
>> > end
>> > su year, meanonly
>> > loc ny=r(max)-r(min)+1
>> > loc fy=r(min)
>> > tempfile allyrs
>> > preserve
>> > drop _all
>> > set obs `ny'
>> > g year=`fy'+_n-1
>> > save `allyrs'
>> > restore
>> > append using `allyrs'
>> > fillin firm year
>> > drop if mi(firm)
>> > tsset firm year
>> > sort firm year
>> > g double d=.
>> > qui forv i=3/`=_N-2' {
>> >  loc f=`i'-2
>> >  loc l=`i'+2
>> >  if firm[`f']==firm[`i'] & firm[`l']==firm[`i'] {
>> >  cap reg y year in `f'/`l' if firm==firm[`i']
>> >  if _rc==0 {
>> >  if e(N)>2 {
>> >  predict double ye if e(sample), resid
>> >  reg x year in `f'/`l' if firm==firm[`i']
>> >  predict double xe if e(sample), resid
>> >  reg ye xe
>> >  replace d=_b[xe] in `l'
>> >  drop ye xe
>> >  }
>> >  }
>> >  }
>> > }
>> > li, noo sepby(firm)
>> >
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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