LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 20 Apr 2004 14:13:55 -0400
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Re: Increasing a variable
Comments:   To: "Kamau, Patrick" <Pkamau@cdcnairobi.mimcom.net>
In-Reply-To:   <4D7CB3BFC594D61183630002A534A6252E5962@cdcmail.cdc>
Content-Type:   text/plain; charset="us-ascii"; format=flowed

At 05:49 AM 4/19/2004, Kamau, Patrick wrote:

>I have a variable called 'return visits' that takes care of clients >who have come for another visit. For the initial visit, return >visit=0 and subsequent returns visits=1. > >I would like to have increasing numbers showing the real return, using >the date or month, i.e. >First visit =0 >Second visit =1 >Third visit =2 etc. >Your help will be appreciated.

Jan Spousta had one interpretation of this. Here's a different one; is this what you were looking for? It does NOT use your original "return visit" variable at all.

Assuming . Client is identified by a variable named CLIENTID . Visit date is an SPSS date variable, VIS_DATE. . Your file is the SPSS working data file

/* The SORT is not necessary if your data is already sorted */ SORT CASES BY CLIENTID VIS_DATE.

NUMERIC RTRN_VIS (F2). VARIABLE LABELS RTRN_VIS 'Return visit # (0=initial visit').

DO IF $CASENUM = 1. . COMPUTE RTRN_VIS = 0. ELSE IF CLIENTID NE LAG(CLIENTID). . COMPUTE RTRN_VIS = 0. ELSE. . COMPUTE RTRN_VIS = LAG(RTRN_VIS) + 1. END IF.


Back to: Top of message | Previous page | Main SPSSX-L page