Hi,
I have a sample of several thousands IDs, over the period 2004 - 2015 inclusive. I have a variable which is constant over the years 2004-2012 inclusive and would like to calculate the median for each ID over this period, and report this number in each of the entries corresponding to 2004-2012 inclusive.
Based on the comparison of this median variable by ID with the median across all ID, 2004-2012 period I would like to create a dummy which is 1 if the median of the ID across the years 2004-2012 was lower than the median across all IDs and years 2004-2012 inclusive. Then I would like the dummy to apply to all periods of the dataset.
So in the end the dummy would be either 0 or 1 for all years, but differ by ID. The idea is to dichotomise all variables into no/yes for a particular variable before regulatory changes came into effect in 2013.
Any suggestions on how I can do this would be greatly appreciated.
Thanks,
John
I have a sample of several thousands IDs, over the period 2004 - 2015 inclusive. I have a variable which is constant over the years 2004-2012 inclusive and would like to calculate the median for each ID over this period, and report this number in each of the entries corresponding to 2004-2012 inclusive.
Based on the comparison of this median variable by ID with the median across all ID, 2004-2012 period I would like to create a dummy which is 1 if the median of the ID across the years 2004-2012 was lower than the median across all IDs and years 2004-2012 inclusive. Then I would like the dummy to apply to all periods of the dataset.
So in the end the dummy would be either 0 or 1 for all years, but differ by ID. The idea is to dichotomise all variables into no/yes for a particular variable before regulatory changes came into effect in 2013.
Any suggestions on how I can do this would be greatly appreciated.
Thanks,
John
Comment