hello users,
I wish to generate a uniquely identifiable variable. the Uk Labour Force Survey that I am using has a variable to identify the household called "caseid" but there can be multiple observations under this id. there is a variable "persn" to identify which person they are of the household - 1 being the head of the household.
i previously did the following:
gen unique_id = caseid * 1000 + persn
format unique_id %12.0f
but when appending the datasets stata said that unique_id did not uniquely identify individuals.
I also did the following:
egen id = group(caseid)
this did not give the desired outcome. i need the id numbers obviously to be consistent for when i append the data, so that the same individual has the same id in each dataset.
any help greatly appreciated.
I wish to generate a uniquely identifiable variable. the Uk Labour Force Survey that I am using has a variable to identify the household called "caseid" but there can be multiple observations under this id. there is a variable "persn" to identify which person they are of the household - 1 being the head of the household.
i previously did the following:
gen unique_id = caseid * 1000 + persn
format unique_id %12.0f
but when appending the datasets stata said that unique_id did not uniquely identify individuals.
I also did the following:
egen id = group(caseid)
this did not give the desired outcome. i need the id numbers obviously to be consistent for when i append the data, so that the same individual has the same id in each dataset.
any help greatly appreciated.
Comment