Hi folks- I have a panel dataset that looks roughly like the example below. In my dataset, I have 5 years of observations, by day, for each individual. In this example, I've only included two months per year to keep it simple.
I'm trying to replace some individuals' missing values with the same time values as a specific other individual. In this example, indivual 3 is missing values of "measurement", and I want to replace these with the Individual 1's values of "measurement", matched by time. So, my current dataset looks like this:
And I need it to look like the example below. Any help would be greatly appreciated! Thanks.
I'm trying to replace some individuals' missing values with the same time values as a specific other individual. In this example, indivual 3 is missing values of "measurement", and I want to replace these with the Individual 1's values of "measurement", matched by time. So, my current dataset looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte individual int year byte(month measurement) 1 2010 1 2 1 2010 2 9 1 2011 1 7 1 2011 2 5 1 2012 1 5 1 2012 2 4 2 2010 1 12 2 2010 2 2 2 2011 1 10 2 2011 2 7 2 2012 1 6 2 2012 2 3 3 2010 1 . 3 2010 2 5 3 2011 1 7 3 2011 2 . 3 2012 1 . 3 2012 2 9 end
And I need it to look like the example below. Any help would be greatly appreciated! Thanks.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte individual int year byte(month measurement) 1 2010 1 2 1 2010 2 9 1 2011 1 7 1 2011 2 5 1 2012 1 5 1 2012 2 4 2 2010 1 12 2 2010 2 2 2 2011 1 10 2 2011 2 7 2 2012 1 6 2 2012 2 3 3 2010 1 2 3 2010 2 5 3 2011 1 7 3 2011 2 5 3 2012 1 5 3 2012 2 9 end
Comment