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

# Re: st: exit variable in opreg by Yasar, Raciborski, Poi (2008)

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: exit variable in opreg by Yasar, Raciborski, Poi (2008) Date Fri, 2 Mar 2012 08:01:45 +0000

```I suspect a precision problem with your firm identifiers which are all
displayed here as 1e9. I guess these should be very slightly different
but the values have (by default) been put in a -float- variable and
come out as identical in some cases where they should be different.
Use a -double- instead and check your data. Consider as an equivalent
example

. set obs 10
obs was 0, now 10

. gen id = 1e9

. replace id = id + 1 in 6/L

. l

+----------+
|       id |
|----------|
1. | 1.00e+09 |
2. | 1.00e+09 |
3. | 1.00e+09 |
4. | 1.00e+09 |
5. | 1.00e+09 |
|----------|
6. | 1.00e+09 |
7. | 1.00e+09 |
8. | 1.00e+09 |
9. | 1.00e+09 |
10. | 1.00e+09 |
+----------+

. format id %12.0f

. l

+------------+
|         id |
|------------|
1. | 1000000000 |
2. | 1000000000 |
3. | 1000000000 |
4. | 1000000000 |
5. | 1000000000 |
|------------|
6. | 1000000000 |
7. | 1000000000 |
8. | 1000000000 |
9. | 1000000000 |
10. | 1000000000 |
+------------+

Around 1 billion, different integers cannot all be held as distinct
values in a -float-. -search precision- for (many) explanations of
this.

This is nothing to do with -opreg-. By the way, your reference is
incomplete: the journal, volume and pages is not given. On Statalist
we ask for the same standards with references as you would expect in
decent published papers.

Nick

On Fri, Mar 2, 2012 at 4:46 AM, Michel Serafinelli
<serafine@econ.berkeley.edu> wrote:

> I want to use the opreg routine by Yasar, Raciborski, Poi (2008)
> “Production function estimation in Stata using the Olley and Pakes
> method” (YRP)
>
>  In this routine exit is a dummy with 1 indicating the firm exited in
> the current period.
>
> at pag 227 of their article, YRP show the commands on how to construct
> the exit variable.
>
> However this does not seem to work for me.
>
> I copy the log file below in which I also list the first 30
> observations in the dataset. You can see for instance in the
> observation 16 and 28 of the dataset the variable exit takes value 1
> even if the firm is not exiting.
>
> Please let me know if you have any suggestion, thanks!
>

> . xtset tax_code year
>       panel variable:  tax_code (unbalanced)
>        time variable:  year, 1995 to 2001, but with gaps
>                delta:  1 unit
>
> . rename tax_code firmid_op
>
> . sort firmid_op year
>
> . by firmid_op: gen count = _N
>
> . * my dataset is for the period 95-2001 while YRP have data for 95-2002
> . gen survivor = count == 7
>
> . gen has95 = 1 if year == 2001
> (14464 missing values generated)
>
> . sort firmid_op has95
>
> . by firmid_op: replace has95 = 1 if has95[_n-1] == 1
>
> . replace has95 = 0 if has95 == .
>
> . sort firmid_op year
>
> . by firmid_op: gen has_gaps = 1 if year[_n-1] != year-1 & _n != 1
> (16414 missing values generated)
>
> . sort firmid_op has_gaps
>
> . by firmid_op: replace has_gaps = 1 if has_gaps[_n-1] == 1
>
> . replace has_gaps = 0 if has_gaps == .
>
> . by firmid_op: generate exit = survivor == 0 & has95 == 0 & has_gaps
> != 1 & _n == _N
>
> . replace exit = 0 if exit == 1 & year == 2001
>
> . * now we can see that this is not working
> . xtset firmid_op year
>       panel variable:  firmid_op (unbalanced)
>        time variable:  year, 1995 to 2001, but with gaps
>                delta:  1 unit
>
> . *note: matr_az is the string variable corresponding to the
> identifier "tax_code/firmid_op" (1:1 relantionship between the two)
> . list in 1/30
>
>     +----------------------------------------------------------------------------+
>     | year      matr_az   firmid_op   count   survivor   has95
> has_gaps   exit |
>     |----------------------------------------------------------------------------|
>  1. | 1995   1000009303   1.000e+09       7          1       1
>  0      0 |
>  2. | 1996   1000009303   1.000e+09       7          1       1
>  0      0 |
>  3. | 1997   1000009303   1.000e+09       7          1       1
>  0      0 |
>  4. | 1998   1000009303   1.000e+09       7          1       1
>  0      0 |
>  5. | 1999   1000009303   1.000e+09       7          1       1
>  0      0 |
>     |----------------------------------------------------------------------------|
>  6. | 2000   1000009303   1.000e+09       7          1       1
>  0      0 |
>  7. | 2001   1000009303   1.000e+09       7          1       1
>  0      0 |
>  8. | 1996   1000022830   1.000e+09       6          0       1
>  0      0 |
>  9. | 1997   1000022830   1.000e+09       6          0       1
>  0      0 |
>  10. | 1998   1000022830   1.000e+09       6          0       1
>  0      0 |
>     |----------------------------------------------------------------------------|
>  11. | 1999   1000022830   1.000e+09       6          0       1
>  0      0 |
>  12. | 2000   1000022830   1.000e+09       6          0       1
>  0      0 |
>  13. | 2001   1000022830   1.000e+09       6          0       1
>  0      0 |
>  14. | 1995   1000028092   1.000e+09       6          0       0
>  0      0 |
>  15. | 1996   1000028092   1.000e+09       6          0       0
>  0      0 |
>     |----------------------------------------------------------------------------|
>  16. | 1997   1000028092   1.000e+09       6          0       0
>  0      1 |
>  17. | 1998   1000028092   1.000e+09       6          0       0
>  0      0 |
>  18. | 1999   1000028092   1.000e+09       6          0       0
>  0      0 |
>  19. | 2000   1000028092   1.000e+09       6          0       0
>  0      0 |
>  20. | 1995   1000035962   1.000e+09       7          1       1
>  0      0 |
>     |----------------------------------------------------------------------------|
>  21. | 1996   1000035962   1.000e+09       7          1       1
>  0      0 |
>  22. | 1997   1000035962   1.000e+09       7          1       1
>  0      0 |
>  23. | 1998   1000035962   1.000e+09       7          1       1
>  0      0 |
>  24. | 1999   1000035962   1.000e+09       7          1       1
>  0      0 |
>  25. | 2000   1000035962   1.000e+09       7          1       1
>  0      0 |
>     |----------------------------------------------------------------------------|
>  26. | 2001   1000035962   1.000e+09       7          1       1
>  0      0 |
>  27. | 1996   1000039407   1.000e+09       3          0       0
>  0      0 |
>  28. | 1997   1000039407   1.000e+09       3          0       0
>  0      1 |
>  29. | 1998   1000039407   1.000e+09       3          0       0
>  0      0 |
>

*
*   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/
```