Hi there,
I'm having an unblanced dataset which look like as the following:
id year values
1 2000 123
1 2001 234
1 2002 .....
1 2003 ....
2 2001
2 2002
2 2003
2 2004
2 2005
3 2000
3 2004
3 2005
3 2008
3 2009
I would like to balance the unbalanced dataset. Difficuties I face here:
1. for each id, they may not have data across all period.
2. for each id, the year may not be continous. E.g. for id 3 from 2000 to 2009, value of x is missing during 2001 and 2003. This difficulty stops me from trying xtbalance, range(), since I'm not sure about the rangem, that is which years covers the most of my observations.
what I will have finally from the table above:
id year values
2 2004
2 2005
3 2004
3 2005
That is to say, keep the years which covers most of my observations.
Any suggestions will be appreciated!
Related Posts with Identify the time dimension in unbalanced dataset
Using ascol command to calculate weekly returns using CRSP daily returnsI tried to convert daily stock returns to weekly returns for panel data with firm, date, and returns…
error in reshapingi have the data ----------------------- copy starting from the next line ----------------------- Co…
Why is TFP calculated by prodest+acf+translog much bigger that TFP calculated by prodest+acf?Dear statalists: I want to use prodest to estimate TFP,but my production function is a translog-for…
Creating a variable as a matrix of five othersHi, My dataset has variables such as province, and five other items (club church library hospital s…
Error r(321) after trying to conduct p for trend analysisHello Stata Listers, Thankyou for reading my query! I currently am using a dataset with 52 variable…
Subscribe to:
Post Comments (Atom)
0 Response to Identify the time dimension in unbalanced dataset
Post a Comment