Hello, statalist!
I am struggling with the replace the value for the same person.
In the dataset, there are two observations, but they are the same person.
I do not want to drop duplicates but just replace the value which is shown as "SAME AS~" with the value.
Since ID=1 and ID=2 is the same person, name, mothername, fathername, and gender is the same.
But, they have different value in birthyear and birthmonth.
I have no idea how to do it.
Do I have to detect all of duplicates and replace it?
So, I was trying
code:
duplicates list name mothername fathername gender
but after then, I do not have any good idea to deal with this.
I want ID=2 to have same value as ID=2 in birthyear and birthmonth because their name, mothername, fathername, and gender is the same (which means same person)
So.. if two observations have the same value in name, mothername, fathername, and gender, then replace the birthyear and birthmonth with the same value as the other one.
Is it fast to replace "SAME AS~" with the blank?
==========================================data==== ===
ID name mothername fathername gender birthyear birthmonth
1 XXX ABC DEF female "1991" "9"
2 XXX ABC DEF female "SAME AS ID=2" "SAME AS ID=2"
3 AAA EFG GED male "1980" "5"
4 BBB FGH HBE female "1960" "3"
.
.
.
================================================== ==
I would greatly appreciate it if you give me any solution for this!
Thank you in advance.
Related Posts with Same value for duplicates
Predicting standardized residuals after mlogit (multinomial logistic regression) using svyset?Dear users, I kindly ask for your guidance regarding my following problem: I am conducting a multin…
standardized difference (SD) Burgstahler & DichevDear all, I want to compute the standardized difference statistic using histograms for panel data s…
Problem with gaps in data in Stata- problem with commands like dfuller. Please help!Hello, I have a big problem with my data. When I am writing a command in Stata (for example dfuller)…
Fixed effect correlation matrixDear all, What is the command in stata to excecute a fixed effects correlation matrix of the variab…
Help with table and export to word fileHi, I'm having some trouble to make a basic table. I don't want any summary statistics, just make a…
Subscribe to:
Post Comments (Atom)
0 Response to Same value for duplicates
Post a Comment