| Date: | Sun, 28 Feb 1999 16:00:56 -0600 |
| Reply-To: | "Matheson, David" <davidm@SPSS.COM> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU> |
| From: | "Matheson, David" <davidm@SPSS.COM> |
| Subject: | Re: Help with syntax |
|
Kai and Peter and all,
This is the most efficient approach among the replies that I've seen to this
request.
Once you read moves.dat, you can run a simple CROSSTABS or TABLES command.
However, there is 1 error to correct.
compute dest = stops(#i) .
should be
compute dest = stops(#i+1) .
which I'm sure is what Kai intended. I also wanted to point out that you can
save directly to an SPSS system file in a loop and/or DO IF set by using the
XSAVE command, as in
do if ~sysmis(dest) .
XSAVE OUTFILE = 'moves.dat' / KEEP from dest .
end if .
If you plan to use the new file in SPSS, anyway,
this can avoid a lot of worries regarding missing values, rounding, spacing,
etc.
You might also want to consider a variable name other than "from", which is
a keyword in some SPSS commands - maybe "depart".
David Matheson
SPSS Technical Support
-----Original Message-----
From: Kai Borgolte [mailto:Kai.Borgolte@HOME.IVM.DE]
Sent: Friday, February 26, 1999 10:40 AM
To: SPSSX-L@UGA.CC.UGA.EDU
Subject: Re: Help with syntax
"Peter Newcombe" <newc@psy.uq.edu.au> schrieb in
<7b3bdn$uu0$1@bunyip.cc.uq.edu.au>:
>We
>would like to gain data relevant to the number of times people travelled
>from point A to Point B (regardless of whether it may have been from Stop 1
>to 2 or Stop 9 to 10) as well as times (ie frequency of trips) travelled
>from Point B to Point A.
The following syntax creates a data file with one case for each move.
Hope that helps.
vector stops = stop1 to stop10 .
loop #i = 1 to 9 .
compute from = stops(#i) .
compute dest = stops(#i) .
do if ~sysmis(dest) .
write outfile = 'moves.dat' / from ' ' dest .
end if .
end loop .
execute .
data list file = 'moves.dat' list / from dest .
--
Kai Borgolte, Bonn
|