* This macro is useful when you need to remove duplicate values within the same case. * For instance in the data below, the 3rd case has 11 in variable c and d. * By default, a new variable named 'miss' flags the cases with no values for the variables listed in the macro call. A different name for that variable can be specified with the parameter zm. * Macro sent to Ray by Maciek Lobinski on 2002/05/24. data list list /a b c d. begin data 5 7 0 0 5 9 10 5 5 7 11 11 6 7 10 8 6 7 13 4 5 7 9 6 1 13 14 1 . . . 1 7 13 1 2 2 2 7 end data. define duble (!positional= !charend('|') /zm =!default(miss) !charend('|')) . !let !ciag=''. !let !jeden=''. !let !dwa=''. recode !1 (0=sysmis). !do !i !in (!1). !let !jeden=(!i). !do !j !in (!1). !let !dwa=(!j). !if (!jeden<>!dwa) !then if (!i=!j) !j=$sysmis. !ifend. !doend. !doend. !do !i !in (!1). !let !ciag=!concat(!ciag,',',!i). !doend. !let !ciag=!tail(!ciag). if (nvalid(!ciag)=0) !zm=0. value labels /!zm 0'missing case'. !enddefine. *example. duble a b c d. *or. duble a b c d |zm=myvar.