Dear community,
I am currently trying to identify different individuals(across several years) within a dataset, whi have been given the same identifyer.
To do this I wanted to generate two variables identifying duplicates in terms of:
1. the ID used
and
2. the ID in combination with sex and birthday
sort person_id
quietly by person_id : gen dupIDLT = cond(_N==1,0,_n)
sort person_id person_id birthday sex
quietly by person_id birthday sex: gen dupLT = cond(_N==1,0,_n)
However, when generating these there may be 3 dupicates each, but dupIDLT may be numbered 1,2,3 while dupLT is numbered 1,3,2 for the observations in years 2005-2007.
How can I achieve that both are numbered 1,2,3?
Best wishes,
Jil
Related Posts with Consistently sorting data ahead of generating duplicates
two way scatterI have a problem with two way scatter. I am using the following command to plot as in the followin…
sts graph risktable order errorAll, I'm getting an error re-labeling the risktable variables. I've searched for solutions and have…
Help interpreting longitudinal mixed model interaction termHi all I have data from a randomized trial that measures the effect of an intervention group (0/1) …
Name of the current do fileIs there a way to get the name of the currently executing do-file into a macro? I had hoped to inclu…
Graph for interaction modelsHi, I am checking if some personality traits (Big Five), are interacting in an survey-experiment. T…
Subscribe to:
Post Comments (Atom)
0 Response to Consistently sorting data ahead of generating duplicates
Post a Comment