Date: Thu, 10 Feb 2000 01:17:38 -0300
Reply-To: hmaletta@overnet.com.ar
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Hector E. Maletta" <hmaletta@OVERNET.COM.AR>
Subject: Re: compute across cases
Content-Type: text/plain; charset=us-ascii
You should create a new file with a different structure. Try the
following:
get file 'oldfile.sav'.
sort cases by date fund.
select if (fund='A').
rename variable (value=valuea).
save outfile 'funda.sav'/drop fund.
get file 'oldfile.sav'.
sort cases by date fund.
select if (fund='B').
rename variable (value=valueb).
save outfile 'fundb.sav'/drop fund.
match files /file='funda.sav'/file=fundb.sav'/by date.
save outfile 'newfile.sav'.
REPEAT THESE INSTRUCTIONS FOR FUND C AND ANY OTHER FUND.
The new file has the following structure:
date valuea valueb valuec valued
1/6/99 100 100 100 100
2/6/99 102 104 104 .....
3/6/99 103 105 .............
Whenever some of the funds do not have information for a certain date,
the funds without value for that date would have a system-missing value.
Repeating the instructions for all funds may be cumbersome if you have
many funds involved, which I suspect is not your case. However, in that
case there are more concise solutions.
Hector Maletta
Universidad del Salvador
Buenos Aires, Argentina
Paolo Orifici wrote:
>
> Hi list members,
>
> I have the following data structure:
>
> fund date value
> A 1/6/1999 100
> A 2/6/1999 102
> A 3/6/1999 103
> B 1/6/1999 100
> B 2/6/1999 104
> B 3/6/1999 105
> C 1/6/1999 100
> C 2/6/1999 104
>
> How could I compute by syntax a new variable that compares the value of
> fund A at a certain date with the value of fund B at the same date.
>
> As some funds quitted during the period of analysis, the lenght of the time
> series is not always the same for the different funds.
>
> Thanks
>
> Paolo Orifici