12.07.2015 Views

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

25Getting<strong>Data</strong>into<strong>SPSS</strong>• TYPE=ODBC indicates that an ODBC driver will be used to read the data. This isrequired <strong>for</strong> reading data from any database, <strong>and</strong> it can also be used <strong>for</strong> other datasources with ODBC drivers, such as Excel workbooks. For more in<strong>for</strong>mation, seeReading Multiple Worksheets on p. 32.• CONNECT identifies the data source. For this example, the CONNECT string wascopied from the comm<strong>and</strong> syntax generated by the <strong>Data</strong>base Wizard. The entirestring must be enclosed in single or double quotes. In this example, we have splitthe long string onto two lines using a plus sign (+) to combine the two strings.• The SQL subcomm<strong>and</strong> can contain any SQL statements supported by the database<strong>for</strong>mat. Each line must be enclosed in single or double quotes.• SELECT * FROM CombinedTable reads all of the fields (columns) <strong>and</strong> allrecords (rows) from the table named CombinedTable in the database.• Any field names that are not valid <strong>SPSS</strong> variable names are automaticallyconverted to valid variable names, <strong>and</strong> the original field names are used as variablelabels. In this database table, many of the field names contain spaces, which areremoved in the variable names.Figure 3-1<strong>Data</strong>base field names converted to valid variable namesExampleNow we’ll read the same database table—except this time, we’ll read only a subset offields <strong>and</strong> records.*access2.sps.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!