t***@gmail.com
2016-04-15 13:35:02 UTC
Hi all
I'm new to SPSS and struggling with syntax to drop duplicate cases. The duplicates are not the same in all variables - they have been double entered but on different dates. I want to exclude all but the first record (by date of entry) for each patient. In Stata I would do this using the following syntax:
/* sort by the identifying variables (PatientID for simplicity) and by date of data entry */
sort PatientID DateOfDataEntry
/* drop all duplicate records of PatientID except the first one */
by PatientID: drop if _n > 1
Is there a way of doing this in SPSS?
Thanks in advance for your help.
Tristan
I'm new to SPSS and struggling with syntax to drop duplicate cases. The duplicates are not the same in all variables - they have been double entered but on different dates. I want to exclude all but the first record (by date of entry) for each patient. In Stata I would do this using the following syntax:
/* sort by the identifying variables (PatientID for simplicity) and by date of data entry */
sort PatientID DateOfDataEntry
/* drop all duplicate records of PatientID except the first one */
by PatientID: drop if _n > 1
Is there a way of doing this in SPSS?
Thanks in advance for your help.
Tristan