clear cd c:\chililabdata\data use inmigration replace img_date=img_date/86400000 format img_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_inmigration, replace