Structuring panel data
Posted: Wed Jan 21, 2015 11:17 am
Hi
I have created an example similar to the "Kansas" example in the help menu for structuring panel data (see the first table below and the attached excel file). There are two different observations for fnr=5. But for each dublicate of fnr, i want the fnr = 5 to be the sum of x for the duplicate year and registered to the industry where x is largest. In that case the data would be structured according to the second table below. (fnr=5 2004 192=164+28 1)
Can you please show me the code for creating a dated panel from this data?
In other words, i want the fnr to be the unique identifiers and i want lag operators to refer to the same fnr in the preceeding year (which is not the way it is done in the kansas example).
Thomas
fnr year x industry
1 2001 100 1
1 2002 150 1
1 2004 130 1
2 2002 120 1
2 2003 120 1
2 2004 156 1
3 2004 151 1
3 2005 164 1
3 2006 154 1
4 2002 135 1
4 2004 125 1
5 2001 176 1
5 2002 195 1
5 2003 154 1
5 2004 168 1
5 2004 24 2
5 2006 165 1
fnr year x industry
1 2001 100 1
1 2002 150 1
1 2004 130 1
2 2002 120 1
2 2003 120 1
2 2004 156 1
3 2004 151 1
3 2005 164 1
3 2006 154 1
4 2002 135 1
4 2004 125 1
5 2001 176 1
5 2002 195 1
5 2003 154 1
5 2004 192 1
5 2006 165 1
I have created an example similar to the "Kansas" example in the help menu for structuring panel data (see the first table below and the attached excel file). There are two different observations for fnr=5. But for each dublicate of fnr, i want the fnr = 5 to be the sum of x for the duplicate year and registered to the industry where x is largest. In that case the data would be structured according to the second table below. (fnr=5 2004 192=164+28 1)
Can you please show me the code for creating a dated panel from this data?
In other words, i want the fnr to be the unique identifiers and i want lag operators to refer to the same fnr in the preceeding year (which is not the way it is done in the kansas example).
Thomas
fnr year x industry
1 2001 100 1
1 2002 150 1
1 2004 130 1
2 2002 120 1
2 2003 120 1
2 2004 156 1
3 2004 151 1
3 2005 164 1
3 2006 154 1
4 2002 135 1
4 2004 125 1
5 2001 176 1
5 2002 195 1
5 2003 154 1
5 2004 168 1
5 2004 24 2
5 2006 165 1
fnr year x industry
1 2001 100 1
1 2002 150 1
1 2004 130 1
2 2002 120 1
2 2003 120 1
2 2004 156 1
3 2004 151 1
3 2005 164 1
3 2006 154 1
4 2002 135 1
4 2004 125 1
5 2001 176 1
5 2002 195 1
5 2003 154 1
5 2004 192 1
5 2006 165 1