Diff for "FAQ/lag" - CBU statistics Wiki
location: Diff for "FAQ/lag"
Differences between revisions 3 and 4
Revision 3 as of 2013-03-08 10:17:36
Size: 463
Editor: localhost
Comment: converted to 1.6 markup
Revision 4 as of 2013-03-26 16:14:31
Size: 591
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
If a case has the same three values as an earlier case in the file then the variable copy will equal 3 (or more generally the number of variables being compared). If a case has the same three values as an earlier case in the file then the variable copy will equal 3 (or more generally the number of variables being compared). As an alternative Version 19 of SPSS and later now has an 'Identify duplicate cases' option in the data menu which may be used.

How do I detect duplicate cases without having an ID number?

This example syntax detects if cases have identical values jointly on three variables, a, b and c. If a case has the same three values as an earlier case in the file then the variable copy will equal 3 (or more generally the number of variables being compared). As an alternative Version 19 of SPSS and later now has an 'Identify duplicate cases' option in the data menu which may be used.

sort cases by a.
exe.
compute copy=0.
exe.
do repeat r=a b c.
if (r eq lag(r)) copy=copy+1.
end repeat.
exe.

None: FAQ/lag (last edited 2013-03-26 16:14:31 by PeterWatson)