Date: Thu, 28 Aug 2008 11:32:20 -0700
Reply-To: johnwatson_1981@yahoo.com
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: John Watson <johnwatson_1981@yahoo.com>
Subject: Re: Writing syntax for 500 times
In-Reply-To: <48B6A956.7030508@DrKendall.org>
Content-Type: text/plain; charset=us-ascii
Thanks all for great support. With great input from albert and richard I got the problem solved.
--- On Thu, 8/28/08, Art Kendall <Art@DrKendall.org> wrote:
From: Art Kendall <Art@DrKendall.org>
Subject: Re: Writing syntax for 500 times
To: SPSSX-L@LISTSERV.UGA.EDU
Date: Thursday, August 28, 2008, 1:34 PM
I have not done macros in some time, but it looks like you are trying to
find duplicate cases on each of 500 variables! which does not make sense?
Or it seems that you are trying to find duplicates within 500 ID numbers.
There would be no need to use a macro for this.
Please explain in more detail what it is you want to do.
Art
Carlos Renato wrote:
> Dear Friend
>
> Try this and report me about.
>
> DEFINE macrorun500 (!POSITIONAL !TOKENS(1))
>
> !DO !Var= 1 !TO !1.
> /* First step.
> USE ALL.
> COMPUTE filter_$=(!CONCAT('X',!Var)=1).
> VARIABLE LABEL filter_$ 'x1=1 (FILTER)'.
> VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> FORMAT filter_$ (f1.0).
> FILTER BY filter_$.
> EXECUTE .
> USE ALL.
>
> COMPUTE !CONCAT('FILTER_',!Var)=filter_$.
> EXECUTE.
>
> /*Second step.
>
> * Identify Duplicate Cases.
> SORT CASES BY !CONCAT('ID',!Var) (A) .
> MATCH FILES /FILE = * /BY !CONCAT('ID',!Var)
> /FIRST = PrimaryFirst /LAST = PrimaryLast.
> DO IF (PrimaryFirst).
> COMPUTE MatchSequence = 1 - PrimaryLast.
> ELSE.
> COMPUTE MatchSequence = MatchSequence + 1.
> END IF.
> LEAVE MatchSequence.
> FORMAT MatchSequence (f7).
> COMPUTE InDupGrp = MatchSequence > 0.
> SORT CASES InDupGrp(D).
> MATCH FILES /FILE = * /DROP = PrimaryFirst InDupGrp MatchSequence.
> VARIABLE LABELS PrimaryLast 'Indicator of each last matching case as
> Primary' .
> VALUE LABELS PrimaryLast 0 'Duplicate Case' 1 'Primary
Case'.
> VARIABLE LEVEL PrimaryLast (ORDINAL).
> FREQUENCIES VARIABLES = PrimaryLast .
> EXECUTE.
>
> RENAME VARIABLES (PrimaryLast=!CONCAT('IDENT_DUPLICATES_ID',!Var).
> EXECUTE.
>
>
> !DOEND.
> !ENDDEFINE.
>
> MacroRun500 3.
>
> Carlos Renato
> Statistician
> Brazil
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|