Date: Tue, 16 Sep 2003 09:00:06 -0400
Reply-To: Art@DrKendall.org
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Arthur J. Kendall" <Art@DrKendall.org>
Organization: Social Research Consultants
Subject: Re: Do repeat, do if end if, recode > 2x 288 variables
In-Reply-To: <BE3A434A142308428AB1E59E334E6E877851A0@excmig2.intra.dlr.de>
Content-Type: text/plain; charset=us-ascii; format=flowed
see if this works.
I didn't think you wanted to change the values of all of the variables
in wo, only the one corresponding to the same time.
DO REPEAT akt = zha1 to zha288 /wo = zwo1 to zwo288.
DO IF (akt EQ 1030) AND (wo = 1).
COMPUTE wo = 3000.
ELSE IF (akt EQ 1030) AND (wo = 2).
COMPUTE wo = 3001.
END IF.
END REPEAT.
Hope this helps.
Art
Art@DrKendall.org
Social Research Consultants
University Park, MD USA
(301) 864-5570
Schmid, Hans-Peter wrote:
> Dear List,
>
> i have the following dataset (time-use data):
>
> 288 variables zha1 to zha288 which symolise 5minute - units (288x5= 24hours=
> 1 day).
> In each 5minute unit, there is a value for a acvivity (1002 means work for
> example, 1007 is freetime).
>
> and
>
> 288 variables zwo1 to zwo288 which have the values 1=at home and 2=not at
> home (for the activities mentioned above).
>
> My problem is the following:
>
> zha1 zha2 zha3 ... zwo1 zwo2 zwo3 ... ...
> zwo288
> 1002 1007 1002 ... 1 1 2 ... ...
>
> I want to RECODE zwo1 to zwo288 so that i have the following values:
>
> zwo1 zwo2 zwo3 ...
> zwo288
> work at home freetime at home work not at home ...
> ...
>
> I tried the following, but my knowledge with do repeat /do if does not seem
> to be sufficient, because basically nothing happens. It might have to do
> with the stand-in variables!
>
> DO REPEAT akt = zha1 to zha288 /wo = zwo1 to zwo288.
> DO IF (akt = 1030) AND (wo = 1).
> RECODE zwo1 TO zwo288 (1 = 3000).
> ELSE IF (akt = 1030) AND (wo = 2).
> RECODE zwo1 to zwo288 (2 = 3001).
> END IF.
> END REPEAT.
>
>
> Or is it better to create 288 new variables for that problem? How would that
> work?
>
> Thank you,
> Hans-Peter Schmid
>
> Deutsches Zentrum f|r Luft- und Raumfahrt e.V. (DLR)
> in der Helmholtz-Gemeinschaft
> Institut f|r Verkehrsforschung (IVF)
> Rutherfordstra_e 2
> 12489 Berlin
> Tel: +49 (0)30/670 55-153
> Fax: +49 (0)30/67055-202
> Internet: <http://www.dlr.de/ivf>
>
|