clear cd c:\chililabdata\data use outmigration replace out_date=out_date/86400000 format out_date %td gen round = substr(observeid, 10,3) gen socialkey = socialgpid+ round gen individkey = individid+ round drop EID socialgpidGuid eventid observeid duplicates drop individkey, force sort individkey save ..\newcode\data\std_outmigration, replace