Importing database files into SPSS

Steve Simon

1999-08-18

*Dear Professor Mean

SPSS can import data from a variety of sources using a system known as ODBC (Object Data Base Connectivity). ODBC has links to just about every database that you would ever need to use.

Short explanation

I’ll show you an example using Microsoft Access

More details

**When you import data using ODBC

I can also specify a particular location that I want to import from on a repeated basis. In the example I show later

After you specify the type of data you want to import

You also have the following options

Saving the query for re-use is another way of simplifying repeated imports from the same data set. Saving the query will save not only the location of hte database you want to import from

Example

Here is an example of importing an Access database with data from a growth hormone study. Select FILE | DATABASE CAPTURE | NEW QUERY from the SPSS menu FILE | DATABASE CAPTURE | NEW QUERY from the SPSS menu.

The dialog box shown above allows you to select your data source. Click on ACCESS 97 and then click on the NEXT button.

The dialog box shown above asks you for a location for your Access database. Be sure that you select the correct drive and folder. Then click on the file

SPSS gives you a list of all available tables and queries within this database.

The dialog box shown above gives you a list of all available tables and queries within this database. Drag the table from the AVAILABLE TABLES field into the RETRIEVE FIELDS IN THIS ORDER field. If you want data from more than one table/query

**If you have a simple import

Saving the query for re-use is another way of simplifying repeated imports from the same data set. Saving the query will save not only the location of hte database you want to import from

What should I do if Access files are not listed as a data source?

On some computers

In order to use these Microsoft Access files

In the ODBC DATA SOURCE ADMINISTRATOR dialog box

In the CREATE A NEW DATA SOURCE dialog box

As the dialog box above shows

Now your dialog box has the format you need. Click on the OK button to finish up. This format will appear every time now when you run a database capture in SPSS.

What should I do if I can’t find the driver for Microsoft Access in the CREATE NEW DATA SOURCE dialog box?

If you are still having problems please let me know. I can suggest several options that might work.

  1. Call our tech support line and ask for help. Explain that your system does not have the ODBC drivers for Microsoft Access installed.

  2. The CD ROM for SPSS has a special folder called ODBC Drivers. Find the file dataacc.exe and run it. I have this CD ROM and will be willing to help you get it running.

  3. You can also go to http://www.microsoft.com/data/

  1. You might also find MDAC on the Microsoft Access or Microsoft Office CD-ROM.

There are some more details in some email messages that appeared on the SPSSX-L listserver on September 10-11

What if SPSS asks for a password?

On some systems

  1. Configure a specific data source for your particular database. In the ODBC MICROSOFT ACCESS 97 dialog box
  1. You can also use SPSS syntax to open the database. Here is an example.
GET DATA
/TYPE = ODBC
/CONNECT = "DSN=MS Access Database;"
"DBQ=C:/Windows\\Desktop\\test.mdb;"
/SQL = "SELECT * FROM [YOUR_TABLE_NAME]".
CACHE.
EXECUTE.

Summary

Vexed Vidya wants to import a Microsoft Access table into SPSS. To import Access or other database formats

You can find an earlier version of this page on my original website.