LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Feb 2002 07:26:48 -0500
Reply-To:     Raynald Levesque <rlevesque@videotron.ca>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@videotron.ca>
Subject:      Re: QUERY: On importing from Access
In-Reply-To:  <906246631AAED511A9A10008C74CE82715C418@IWMIHQX>
Content-Type: text/plain; charset="iso-8859-1"

Hi

Construct a query in access to link the main table and code table. Import this query so that SPSS datafile now contains BOTH the crop descriptions AND crop codes. Then apply the syntax "Apply lab1 as label to var1 by syntax.SPS" which you will find at the following URL

http://pages.infinit.net/rlevesqu/SampleSyntax.htm#LabelsAndVariableNames

Have fun!

Raynald Levesque rlevesque@videotron.ca Visit my SPSS Pages http://pages.infinit.net/rlevesqu/index.htm

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Jayasinghe, Gayathri (IWMI-HQ) Sent: February 6, 2002 1:33 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: QUERY: On importing from Access

This is a long shot I know but thought I'd ask anyway because this is a recurrent need for an efficient solution every time I import from an Access database, and that is nearly every time I work with a dataset.

Access database consists of main table with a variable for crop code and a code table containing crop code and crop description for lookup. This is a scaled down example. The real datasets have many coded variables and as many lookup tables.

Main table

Variable Codes Year Actual Crop 1-4 Yield Actual

Code tables

Crop codes 1 - Rice 2- Wheat 3 - Maize 4 - Cowpea

Question: Is it possible to import the main table so that the SPSS datafile contains the numeric crop codes, but have the value labels picked up from the code tables?

At the moment I have two options. 1/ Import the main table. Write VALUE LABELS syntax to label the crop code with crop description. 2/ Construct a query in access to link the main table and code table. Import this query so that SPSS datafile now contains the crop descriptions instead of crop codes. Then use autorecode. However, autorecode may recode the crops with different codes than those appearing in the original access code tables. This is not ideal.

Any suggestions much appreciated!

Gayathree Jayasinghe Research Associate International Water Management Institute P O Box 2075, Colombo, Sri Lanka. NB: Please note the new telephone and fax numbers Phone: ++ 94 -1- 787404 ++94-1- 784080 Fax: ++ 94 -1- 786854 email: g.jayasinghe@cgiar.org Water for food, nature and rural development. Research results, useful data, policy tools http://www.iwmi.org/


Back to: Top of message | Previous page | Main SPSSX-L page