Date: Wed, 21 Apr 2004 09:40:13 +0200
Reply-To: Spousta Jan <JSpousta@CSAS.CZ>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Spousta Jan <JSpousta@CSAS.CZ>
Subject: Re: Reference value of a variable in computation
Content-Type: text/plain; charset="iso-8859-2"
Hi Shuchita,
if I understand your question properly, then the raw idea is in the syntax below - you can write a macro from it, where the input would be the reference date.
data list / time (a6) price (dollar8.2).
begin data.
Jan 92 $1.12
Feb 92 $1.34
Mar 92 $1.44
Apr 92 $1.55
May 92 $1.45
Dec 94 $1.67
end data.
* define reference date and save it in the file.
string dateref (a6).
compute dateref = "Apr 92".
exe.
* save the price in the reference date in an auxiliary file.
temporary.
select if time = "Apr 92".
save outfile = 'C:\Program Files\SPSS\auxil.sav'
/drop date /rename (price = priceref).
* merge both files and compute the index.
MATCH FILES /FILE=* /TABLE='C:\Program Files\SPSS\auxil.sav' /BY dateref.
compute index = price / priceref.
execute.
* clean up.
delete variables dateref priceref.
Hope this helps
Jan
-----Original Message-----
From: Shuchita Agarwal [mailto:agar0040@umn.edu]
Sent: Wednesday, April 21, 2004 4:47 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Reference value of a variable in computation
Hello!
I have a monthly time series dataset over a period of 10 years. I want to
create a monthly variable that uses a reference value at a particular time
point from another variable in the computation process.
In the following example, price in Apr 92 is $1.55. This $1.55 is used as
a reference point to create a variable called 'index price' which is
computed by dividing the price at a time point by $1.55.
Time Price Index Price (to create)
Jan 92 $1.12 $1.12/$1.55
Feb 92 $1.34 $1.34/$1.55
Mar 92 $1.44 $1.44/$1.55
Apr 92 $1.55* (Ref) $1.55/$1.55
May 92 $1.45 $1.45/$1.55
.
Dec 94 $1.67 $1.67/$1.55
This is to be performed for multiple subgroups.
Any help in this matter will be greatly appreciated.
Thanks in advance,
Shuchita