Date: Mon, 8 May 2006 17:56:25 -0400
Reply-To: Gene Maguin <emaguin@buffalo.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <emaguin@buffalo.edu>
Subject: Re: Convertin a String Variable to Numerical and Assigning New ID
In-Reply-To: <200605082143.k48Lh4RE015739@listserv.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
Linda,
As I understand your dataset, I think this would work. I'll assume that if,
for example, 'Bonnie' is tested at site 2 at time 1, Bonnie will be retested
at time 2 at same site, with no exceptions.
Let name (assumed format is a10), site (assumed format is f1.0), and year be
the relevant variables.
Sort cases by site name time.
* why not combine name and site to form your new id?.
String name1(a11).
Do if (site eq lag(site) and name eq lag(name) and year eq 2005).
+ compute name1=concat(name,string(site,f1.0)).
End if.
Sort cases by site name (a) time (d).
Do if (site eq lag(site) and name eq lag(name) and year eq 2004).
+ compute name1=lag(name1).
End if.
Gene Maguin
|