|Date: ||Thu, 10 Apr 2003 17:10:51 -0400|
|Reply-To: ||Chris Fisher <firstname.lastname@example.org>|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>|
|From: ||Chris Fisher <email@example.com>|
|Subject: ||fill variables|
|Content-Type: ||text/plain; charset=iso-8859-1|
I'm trying this one again....
one row/case for a client looks like this
ID SiteID Tracking1 Tracking2 Tracking3.....Tracking44..........housing1 housing 2 housing 3.........housing44
234 23 11/03/03 11/23/03 12/05/03 4/06/04 rent rent missing missing
347 14 2/15/02 3/3/02 3/24/02 6/15/02 own missing rent missing
What I would like to do is fill in the "missing" fields with the last entered value. So in ID 234, the missings would become rent in "housing 3," and in ID 347 the missing would become own for "housing 2" and then rent for "housing 44". I get close but I can only seem to make a new variable.
I am doing this because when I tried this syntax to count the number of times housing status changed across a row:
SORT CASES BY clientid siteid tracking .
* calculate if there are any changes in housing
DO IF $CASENUM>1 AND clientid=LAG (clientid) .
COMPUTE statchng=LAG (housing) <> housing .
END IF .
It does not correctly count the number of changes since even when a client has this:
rent rent missing rent own rent doubleup transitional rent - where there should be 8 changes (from rent to own, own back to rent, rent to doubleup, doubleup to transitional, and transitional to rent) (these are all coded values) it only counts 4 (perhaps it's only counting the number of different entries???? also, it shouldn't count missing as a change but if the missings can be filled that won't be a problem.