I need to create a panel of spouses for two years. There should be two observations for each spouse with the same spouse id marked next to each other.
Here HHPBASE is a unique personal identifier, PBASE is the id of the repondent in household rooster ,SURVEY is survey round. RO8 is the id of the spouse. SPRO8 is the spouse's spouses id. so I need PBASE and SPRO8 to be equal and same for each person in both rounds.
How do I create a balanced panel?
Here HHPBASE is a unique personal identifier, PBASE is the id of the repondent in household rooster ,SURVEY is survey round. RO8 is the id of the spouse. SPRO8 is the spouse's spouses id. so I need PBASE and SPRO8 to be equal and same for each person in both rounds.
How do I create a balanced panel?
Code:
----------------------- copy starting from the next line ----------------------------------------- copy up to and including the previous line ------------------ Listed 100 out of 161015 observationCode:* Example generated by -dataex-. To install: ssc install dataex clear input double HHPBASE int(PBASE RO3 TK1RO4 RO8 SPRO8 SURVEY) 101020101001 1 1 1 2 1 1 101020101002 2 2 2 1 2 1 101020102001 1 1 1 2 1 1 101020102001 1 1 1 75 . 2 101020102003 3 1 3 4 3 1 101020102003 3 1 3 3 2 2 101020102004 4 2 4 3 4 1 101020102004 4 2 4 2 3 2 101020102008 8 1 3 9 8 1 101020102008 8 1 3 8 7 2 101020102009 9 2 4 8 9 1 101020102009 9 2 4 7 8 2 101020102012 12 1 3 13 12 1 101020102012 12 1 3 13 12 2 101020102013 13 2 4 12 13 1 101020102013 13 2 4 12 13 2 101020103001 1 1 1 2 1 1 101020103001 1 1 1 2 1 2 101020103002 2 2 2 1 2 2 101020103002 2 2 2 1 2 1 101020104001 1 1 1 2 1 2 101020104001 1 1 1 2 1 1 101020104002 2 2 2 1 2 2 101020104002 2 2 2 1 2 1 101020105002 2 1 3 3 2 1 101020105002 2 1 3 2 1 2 101020105003 3 2 4 2 3 1 101020105003 3 2 4 1 2 2 101020106013 13 1 3 14 13 1 101020106013 13 1 3 7 6 2 101020106014 14 2 4 6 7 2 101020106014 14 2 4 13 14 1 101020107001 1 1 1 2 1 2 101020107001 1 1 1 2 1 1 101020107002 2 2 2 1 2 1 101020107002 2 2 2 1 2 2 101020108001 1 1 1 2 1 1 101020108001 1 1 1 2 1 2 101020108002 2 2 2 1 2 2 101020109002 2 2 2 1 2 1 101020109002 2 2 2 75 . 2 101020111001 1 1 1 2 1 1 101020111001 1 1 1 2 1 2 101020112001 1 1 1 2 1 1 101020112001 1 1 1 2 1 2 101020112002 2 2 2 1 2 2 101020112002 2 2 2 1 2 1 101020113001 1 1 1 2 1 1 101020113001 1 1 1 2 1 2 101020113002 2 2 2 1 2 2 101020113002 2 2 2 1 2 1 101020114001 1 1 1 2 1 1 101020114001 1 1 1 2 1 2 101020114002 2 2 2 1 2 2 101020114002 2 2 2 1 2 1 101020116001 1 1 1 2 1 1 101020116001 1 1 1 2 1 2 101020116002 2 2 2 1 2 2 101020116002 2 2 2 1 2 1 101020116003 3 1 3 4 3 2 101020116003 3 1 3 4 3 1 101020116004 4 2 4 3 4 1 101020116004 4 2 4 3 4 2 101020118002 2 2 2 75 . 2 101020118002 2 2 2 1 2 1 101020118004 4 1 3 5 4 2 101020118004 4 1 3 5 4 1 101020118005 5 2 4 4 5 2 101020118005 5 2 4 4 5 1 101020119001 1 1 1 2 1 1 101020119001 1 1 1 2 1 2 101020119002 2 2 2 1 2 2 101020119002 2 2 2 1 2 1 101020120001 1 1 1 2 1 2 101020120001 1 1 1 2 1 1 101020120002 2 2 2 1 2 1 101020120002 2 2 2 1 2 2 101020120003 3 1 3 4 3 1 101020120003 3 1 3 4 3 2 101020120004 4 2 4 3 4 1 101020120004 4 2 4 3 4 2 101020201001 1 1 1 2 1 2 101020201001 1 1 1 2 1 1 101020201002 2 2 2 1 2 1 101020201002 2 2 2 1 2 2 101020202001 1 1 1 2 1 1 101020202001 1 1 1 2 1 2 101020202002 2 2 2 1 2 1 101020202002 2 2 2 1 2 2 101020203001 1 1 1 2 1 2 101020203001 1 1 1 2 1 1 101020203002 2 2 2 1 2 2 101020203002 2 2 2 1 2 1 101020204001 1 1 1 2 1 2 101020204001 1 1 1 2 1 1 101020204002 2 2 2 1 2 2 101020204002 2 2 2 1 2 1 101020205002 2 2 2 1 2 1 101020205002 2 2 2 75 . 2 101020206002 2 2 2 1 2 1 end label values RO3 RO3 label def RO3 1 "Male 1", modify label def RO3 2 "Female 2", modify label values TK1RO4 TK1RO4 label def TK1RO4 1 "Head 1", modify label def TK1RO4 2 "Wife/husband 2", modify label def TK1RO4 3 "Son/daughter 3", modify label def TK1RO4 4 "Child-in-law 4", modify label values RO8 RO8 label def RO8 75 "Died 75", modify label values SPRO8 SPRO8 label values SURVEY SURVEY label def SURVEY 1 "IHDS1 1", modify label def SURVEY 2 "IHDS2 2", modify
Comment