This is my first post so I will try to be as comprehensive as possible. I am currently working with two data sets. One is a weekly snap shot of costs in which each week has a numeric identifier starting in August 2011 to December 2015 (203 weeks). Each snap shot also has a date in which is was taken ie; (04/01/2013). I have used a lag function to compute a snap date out variable that gives me week intervals, this was done to fit the code below. My second data set has a list of events that contain the date in which is the event took place in the same format as previously specified. I am attempting to group events in the second data set into which snap shot interval the belong in the first dataset, either by date or by week identifier.
I have attempted using the following code posted on Raynald's SPSS tools in 2010: http://www.spsstools.net/en/syntax/269/
The code I have adapted from the guide is below.
This is also a quick guide to equivalent variables between he guide and my code:
Code: Select all
GET FILE='O:\Test\Test Data\t3763\3763EventsMatch.sav'. VECTOR dt(3). COMPUTE dt(idx)=Doc.Date. AGGREGATE OUTFILE=* /PRESORTED /BREAK=id /dt1 TO dt3=FIRST(dt1 TO dt3). MATCH FILES /FILE= "O:\Test\Test Data\t3763\3763DateMatch.sav" /TABLE=* /BY id. VECTOR dt=dt 1 TO dt3. LOOP #idx=1 TO 3. DO IF RANGE(dt(#idx),snap_date_in,snap_date_out). COMPUTE idx=#idx. BREAK. END IF. END LOOP.
Code: Select all
>Warning # 525 >An attempt was made to store a value into an element of a vector the subscript >of which was missing or otherwise invalid. The subscript must be a positive >integer and must not be greater than the length of the vector. No store can >occur.