I am not clear whether you want this
dummy variable to apply to all
observations for each firm. That
would be something like
bysort code (time) : gen byte less_than_a = X[1] < a
Nick
[email protected]
Dahlia El-Hawary
> I am working with an unbalanced annual panel data of over 50,000
> observations. The data set is made up of firms within
> countries over a
> time period from 1987 - 2002. I generated a variable called “code” as
> my panel identifier which assigns each firm a number. I also have
> a “countryid” giving each country a number. Year is the variable I am
> using for time.
>
> I would like to know how to identify the first observation of
> variable “X” for each firm in the panel ?. Specifically I would like
> to generate a dummy variable (DV==1) if the value of the first
> observation for variable X (for each firm) is less than “a”,
> and DV==0 otherwise.
*
* 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/