my data set contains duplicates i want to save the duplicates separately or export it then drop all the duplicates from my data set because i want to work with unique observation. please i need help on how to achieve that.
thanks
thanks
*Some fake data li id fake in 1/16, clean noobs id fake 1 .2047095 2 .8927587 2 .8927587 3 .5844658 3 .5844658 3 .5844658 4 .3697791 4 .3697791 4 .3697791 4 .3697791 5 .8506309 5 .8506309 5 .8506309 5 .8506309 5 .8506309 6 .3913819 so id egen tagid = tag(id) //identify unique observations preserve keep if tagid==0 save duplicates.dta, replace //data with duplicates are saved in current directory restore keep if tagid==1 save unique.dta, replace //data with unique observations are saved in current directory use unique.dta, clear li in 1/10, clean noobs id fake tagid 1 .2047095 1 2 .8927587 1 3 .5844658 1 4 .3697791 1 5 .8506309 1 6 .3913819 1 7 .1196613 1 8 .7542434 1 9 .6950234 1 10 .6866152 1
Comment