Date: Tue, 24 Oct 2006 16:57:35 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: Looping complexity for complex situation
In-Reply-To: <9D4BEF69F83C9744AB34E5FE2F78F46DDA0CC5@matrix.mrxin.market
rx.com>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 06:20 PM 10/22/2006, Manmit Shrimali wrote:
>I will have multiple files
THAT shouldn't be a problem. You need to combine the multiple files
into one, by whatever is the appropriate technique - ADD FILES, MATCH
FILES, or whatever.
>My data is coded as follows: City_year1 New York Yes/No and so on.
Like this (SPSS draft output)?
* "My data is coded: City_year1 New York Yes/No and so on." .
* Like this? YR1_PVD 'Visited Providence in year 1' .
* YR1_CRNS 'Visited Cranston in year 1' .
* YR1_WRWK 'Visited Warwick in year 1' .
* YR2_PVD 'Visited Providence in year 2' .
* YR2_CRNS 'Visited Cranston in year 2' .
* YR2_WRWK 'Visited Warwick in year 2' .
* YR3_PVD 'Visited Providence in year 3' .
* YR3_CRNS 'Visited Cranston in year 3' .
* YR3_WRWK 'Visited Warwick in year 3' .
GET FILE=TESTDATA.
TEMPORARY.
STRING SPACE(A28).
LIST.
List
|-----------------------------|---------------------------|
|Output Created |24-OCT-2006 16:43:46 |
|-----------------------------|---------------------------|
C:\Documents and Settings\Richard\My Documents
\Temporary\SPSS
\2006-10-23 Shrimali - Looping complexity for complex situation.SAV
CASE YR1_ YR1_ YR1_ YR2_ YR2_ YR2_ YR3_ YR3_ YR3_
_NUM PVD CRNS WRWK PVD CRNS WRWK PVD CRNS WRWK SPACE
001 1 0 0 1 1 0 0 0 1
002 1 1 1 0 1 0 0 0 1
003 0 1 1 0 1 1 0 0 1
004 0 1 0 1 1 1 1 0 0
005 0 0 0 0 1 0 1 0 0
006 0 1 0 0 1 0 0 1 0
007 0 1 0 0 0 1 0 0 0
008 0 1 1 0 0 0 1 0 1
009 1 1 0 0 0 0 1 0 1
010 0 0 1 1 0 0 1 0 1
011 0 0 1 0 0 0 1 0 0
012 0 1 1 1 0 1 0 0 0
013 0 0 0 0 0 0 0 0 1
014 1 0 0 0 0 1 0 0 1
015 0 0 0 0 1 0 0 0 0
016 0 0 1 0 0 0 0 0 0
017 1 1 0 0 0 1 0 0 0
018 0 1 1 0 0 1 0 1 0
019 0 0 0 0 0 1 0 0 1
020 0 1 1 1 0 0 1 1 1
Number of cases read: 20 Number of cases listed: 20
>I can have multiple combination and I want to get the analysis at
>unique level. For e.g. let say in 1st year I get following group:
>10 people visited city a b and c
[...]
>40 visited city fgh
>
>For each group I want to see which cities they visited in following
>years till 5 year.
That *sounds* like you want to count all different patterns of visiting
over the five years: the set of cities visited the first year BY the
set visited the second year BY the set visited the third year....
That's easy with AGGREGATE (see below), but useless. With 3 cities and
3 years (in my test data) there are 2**(3*3)=512 possible combinations;
as you see none occurs even twice in this test data. 35 cities and 5
years gives 2**(35*5)=5*10**52 combinations.
In the test data I've posted - three cities, three year - what are the
categories you'd like to count?
(By the way, Hillel Vardi described this needing a many-to-many match.
It probably doesn't. If your data is organized like the test data
above, the many-to-many match is already done in the ata records.)
Illustration - count all combinations (SPSS draft output):
* "If 10 people visited city a in first year, I want to know,.
* which cities they visited in year three, let say 5 visited .
* and 5 did not visit at all. Out of 5 who visited in year .
* two, which cities they visited in year 3 and so on" .
* Possibility one: count all combinations: ............... .
* (This is easy with AGGREGATE, but impossible to analyze .
* because there are so many combinations.) .
AGGREGATE OUTFILE=*
/BREAK = YR1_PVD TO YR3_WRWK
/INSTANCES 'Occurrences of this combination' = N.
FORMATS INSTANCES (F4).
TEMPORARY.
STRING SPACE(A24).
LIST.
List
|-----------------------------|---------------------------|
|Output Created |24-OCT-2006 16:43:48 |
|-----------------------------|---------------------------|
YR1_ YR1_ YR1_ YR2_ YR2_ YR2_ YR3_ YR3_ YR3_
PVD CRNS WRWK PVD CRNS WRWK PVD CRNS WRWK INSTANCES SPACE
0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 1 0 0 1 1
0 0 0 0 1 0 0 0 0 1
0 0 0 0 1 0 1 0 0 1
0 0 1 0 0 0 0 0 0 1
0 0 1 0 0 0 1 0 0 1
0 0 1 1 0 0 1 0 1 1
0 1 0 0 0 1 0 0 0 1
0 1 0 0 1 0 0 1 0 1
0 1 0 1 1 1 1 0 0 1
0 1 1 0 0 0 1 0 1 1
0 1 1 0 0 1 0 1 0 1
0 1 1 0 1 1 0 0 1 1
0 1 1 1 0 0 1 1 1 1
0 1 1 1 0 1 0 0 0 1
1 0 0 0 0 1 0 0 1 1
1 0 0 1 1 0 0 0 1 1
1 1 0 0 0 0 1 0 1 1
1 1 0 0 0 1 0 0 0 1
1 1 1 0 1 0 0 0 1 1
Number of cases read: 20 Number of cases listed: 20