Hello,
I am working with a dataset with merged data from 2 survey rounds (2005 & 20011).
The first column/variable 'id' is the unique identification number for the individuals.
The second column/variable "SURVEY" represents whether the observation is from survey 1 or 2
The third column/variable "HHBASE" represents the unique Household Base ID which remains unchanged for the two surveys
As seen in the sample data below, after I have already "sort id", I was expecting that observations from row 11 to row 20 should have been placed before right after the first observation, but it does not seem to be the case. Any suggestions on how this can be fixed?
The idea is that I would like to sort in a way that allows me to see the two observations (from surveys 1 and 2 respectively) for the same id to appear together (if that makes sense).
I am working with a dataset with merged data from 2 survey rounds (2005 & 20011).
The first column/variable 'id' is the unique identification number for the individuals.
The second column/variable "SURVEY" represents whether the observation is from survey 1 or 2
The third column/variable "HHBASE" represents the unique Household Base ID which remains unchanged for the two surveys
As seen in the sample data below, after I have already "sort id", I was expecting that observations from row 11 to row 20 should have been placed before right after the first observation, but it does not seem to be the case. Any suggestions on how this can be fixed?
The idea is that I would like to sort in a way that allows me to see the two observations (from surveys 1 and 2 respectively) for the same id to appear together (if that makes sense).
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 id int SURVEY double HHBASE "10102010201" 2 1010201020 "101020102010" 2 1010201020 "101020102010" 1 1010201020 "101020102011" 2 1010201020 "101020102012" 2 1010201020 "101020102013" 2 1010201020 "101020102014" 2 1010201020 "101020102015" 2 1010201020 "101020102016" 2 1010201020 "101020102017" 2 1010201020 "10102010203" 2 1010201020 "10102010204" 2 1010201020 "10102010205" 2 1010201020 "10102010205" 1 1010201020 "10102010206" 1 1010201020 "10102010206" 2 1010201020 "10102010207" 2 1010201020 "10102010207" 1 1010201020 "10102010208" 2 1010201020 "10102010209" 2 1010201020 end label values SURVEY SURVEY label def SURVEY 1 "IHDS1 1", modify label def SURVEY 2 "IHDS2 2", modify
Comment