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
Estimate GARCH Model from Time SeriesHallo, I am a student and new to Stata. For a university course I have to model a GARCH model from …
How to create dummy variable with condition that it needs to have 3 observation in 5 years?I have a question how to create a dummy variable with certain conditions. I know how to create a dum…
One-sided t test regressionHello everyone, I don't have much experience with STATA and I'm working on my master's thesis. I wo…
(Two-Way) Fixed Effects Model: (Too) Many Post-Treatment Waves & Violated Constant Effect Assumption?Hi, I would be really very grateful for any suggestion on the following topic. I already searched q…
Converting Date formatGreetings. I'm having a challenge converting the date formats with slashes "2/9/2016 14:06" (m/d/yyy…
Subscribe to:
Post Comments (Atom)
0 Response to Same value for duplicates
Post a Comment