Searching for value across variables

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Searching for value across variables

Derek Quinlan
Hi All,

I'm sorry if this has been addressed in the past... tried searching, but
wasn't sure what exact terms to use, so the search was fruitless.

Here is my situation...

I have a bunch of variables (Date1 thru Date1827), as well as
(DateSearch1, Date1 thru DateSearch10) for a couple thousand cases.

Date1 thru Date1827 are simply dates.
DateSearch1 thru DateSearch10 are simply a number from 1 thru 1827.

What I'd like to do is...

1) Create variables DateFound1 thru DateFound10 (that's easy enough)
2) Take the value in DateSearch1, lets say it is 127, then take the date
from Date127 and put that into DateFound1.... and so on for all the
DateSearch variables

Basically, each case has 1827 dates associated with it and I need to pick
out selective dates from those.

I hope my description is clear.

Any help you could offer is greatly appreciated!

Cheers
Derek

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Searching for value across variables

Maguin, Eugene
Derek,

Ok, so DateSearch1 thru DateSearch10 contains the 'number' of the date
variable and you want to transfer the value of the selected date variable to
a DateFound(i) variable such that datefound(i)=date(datesearch(i)).

Be warned. This is untested.
I assume that your data are structured so that DateSearch1 thru DateSearch10
are contigous, date1 thru date1827 are contigous and datefound1 thru
datefound10 are contigous. If not, then this won't work.

Vector search=DateSearch1 to DateSearch10/date=date1 to date1827/
   found=datefound1 to datefound10.
Loop #i=1 to 10.
+  compute #j=search(#i).
+  if (not(sysmis(#j))) found(#i)=date(#j).
End loop.
Execute.

Gene Maguin




>>Here is my situation...

I have a bunch of variables (Date1 thru Date1827), as well as
(DateSearch1, Date1 thru DateSearch10) for a couple thousand cases.

Date1 thru Date1827 are simply dates.
DateSearch1 thru DateSearch10 are simply a number from 1 thru 1827.

What I'd like to do is...

1) Create variables DateFound1 thru DateFound10 (that's easy enough)
2) Take the value in DateSearch1, lets say it is 127, then take the date
from Date127 and put that into DateFound1.... and so on for all the
DateSearch variables

Basically, each case has 1827 dates associated with it and I need to pick
out selective dates from those.

I hope my description is clear.

Any help you could offer is greatly appreciated!

Cheers
Derek

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD