Dear all,
I would consider myself a bloody beginner in Stata and statalist so I might not have found a previous post where this question was already asked, if so please let me know!
To my problem:
My data set has two identifiers, one unique for each participant lets call it "S" and one which is shared for every family member lets call it "F".
For each family "F" I have a member "S" who has a value in the variable "X" while all other members have a missing value.
Now I would like to replace all the missing values in X with the value of the specific family member.
my approach so far:
replace X = value1 if F =="F1"
replace X = value2 if F =="F2"
This is not only time consuming but also increases the risk of human error as it has to be repeated for each family.
So, I am sure that there is a more elegant way to complete this and I would like to know how a more experienced Stata user would tackle this.
thanks for any input!
I would consider myself a bloody beginner in Stata and statalist so I might not have found a previous post where this question was already asked, if so please let me know!
To my problem:
My data set has two identifiers, one unique for each participant lets call it "S" and one which is shared for every family member lets call it "F".
For each family "F" I have a member "S" who has a value in the variable "X" while all other members have a missing value.
Now I would like to replace all the missing values in X with the value of the specific family member.
my approach so far:
replace X = value1 if F =="F1"
replace X = value2 if F =="F2"
This is not only time consuming but also increases the risk of human error as it has to be repeated for each family.
So, I am sure that there is a more elegant way to complete this and I would like to know how a more experienced Stata user would tackle this.
thanks for any input!