Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Identify 1st observation in each group in a panel data model


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Identify 1st observation in each group in a panel data model
Date   Mon, 11 Apr 2005 22:22:27 +0100

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/



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