Statalist The Stata Listserver


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

st: Re: Binary variable after first-differencing


From   "Sergiy Radyakin" <[email protected]>
To   <[email protected]>
Subject   st: Re: Binary variable after first-differencing
Date   Mon, 5 Mar 2007 21:47:57 +0100

Hello Kevin!

sort Firm year
by Firm: gen difdummy=dummy if _n==1
by Firm: replace difdummy=dummy+difdummy[_n-1] if _n>1

This should generate the sequence you desire, though I haven't got your motivation for the transformation of the variable.
Besides notice that diffdummy is not a dummy anymore :)

Regards, Sergiy Radyakin



----- Original Message ----- From: "Amess Kevin" <[email protected]>
To: <[email protected]>
Sent: Monday, March 05, 2007 9:23 PM
Subject: st: Binary variable after first-differencing



Dear All,

I would very much appreciate help on the following problem. My panel
data contain both continuous and binary variables. I want to estimate a
model in first differences but would like to incorporate a binary
variable. So that the binary variable is not first-differenced out of
the equation I want to create difdummy (see below). Basically, I do not
know how to create difdummy. Below illustrates my data:

Firm year dummy difdummy
1 1993 0 0
1 1994 0 0
1 1995 1 1
1 1996 1 2
1 1997 0 2
1 1998 0 2
2 1993 1 1
2 1994 1 2
2 1995 1 3
2 1996 0 3
2 1997 0 3
2 1998 0 3
3 1993 0 0
3 1994 0 0
3 1995 0 0
3 1996 0 0
3 1997 1 1
3 1998 1 2

Regards,
Kevin

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


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