lookup between datasets

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

lookup between datasets

Paola Chivers-2
HI,



I was wondering if there is a way to get SPSS to look up values from one
data set and then return a value to another data set.



For example I have a school code in my main data set for each individual.  I
have another data set that is school information only.  I want it to match
school codes and return to my individual data set the value of various
school information variables.



Is this possible?  If so how?



Regards,

Paola



"Ours has become a time-poor society, fatigued by non-physical demands and
trying to compartmentalize daily living tasks.  It is small wonder that
physical activity is discarded in this environment" p126 (Steinbeck, 2001)



P Please consider the environment before printing this email.

=====================
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: lookup between datasets

Lemon, John S.
Paola

Yes this is easily done by merging files. Make sure that the school code in both files is the same in terms of type and if a string then in size as well. SPSS will not match on variables that are different. Also make sure BOTH files are sorted on school code. Then open the 'individuals' file and from the 'Data' menu and choose 'Merge Files'. From the sub-menu choose 'Add Variables' then pick the 'schools' file from either the 'active' list if you have it open or by browsing. You will see the variables that are common to both files including the school code. You need to check the box 'Match cases on Keyed variables' and then indicate that the 'external' file ( schools ) is a keyed table. Click OK and all should be well if the variables match in type, size and the file is sorted.

Best Wishes

John S. Lemon
Student Liaison Officer
Directorate of Information Technology (DIT) - University of Aberdeen
Edward Wright Building: Room G51
Tel:  +44 1224 273350
Fax: +44 1224 273372


> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> Paola Chivers
> Sent: Tuesday, July 22, 2008 5:54 AM
> To: [hidden email]
> Subject: lookup between datasets
>
> HI,
>
>
>
> I was wondering if there is a way to get SPSS to look up values from one
> data set and then return a value to another data set.
>
>
>
> For example I have a school code in my main data set for each individual.
> I
> have another data set that is school information only.  I want it to match
> school codes and return to my individual data set the value of various
> school information variables.
>
>
>
> Is this possible?  If so how?
>
>
>
> Regards,
>
> Paola
>
>
>
> "Ours has become a time-poor society, fatigued by non-physical demands and
> trying to compartmentalize daily living tasks.  It is small wonder that
> physical activity is discarded in this environment" p126 (Steinbeck, 2001)
>
>
>
> P Please consider the environment before printing this email.
>
> =====================
> 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


The University of Aberdeen is a charity registered in Scotland, No SC013683.

=====================
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