Loading data using the SPSS Import Wizard

Before loading your data into SPSS, unzip your data using these instructions.

Step 1

Open SPSS 18.
Ensure "open an existing data source" is selected and click OK.

The following dialogue box will open and you will be prompted to enter the location of your unzipped data. Choose the R drive and the location of your unzipped data will likely be under  R:groups\project number\etc.

Ensure that you have selected the appropriate file type from the drop down. Text (*txt, *.dat).

Once you have navigated to your data *.txt file click “Open”

Note: If you have not already unzipped your data to *.txt format you must go back to the instructions provided on the PopData Portal describing the Unzip process.

A dialogue box “Text Import Wizard Step 1 of 6 will open”. If it doesn’t, navigate to text import wizard (on the Menu bar choose File, select “Read Text Data” and the Text Import Wizard (below) should appear).

Step 2

Does your text file match a predefined format?

Select “No”

Click Next.

Step 3

How are your variables arranged?

Select “Fixed Width”

Are variable names included at the top of your file?

Select “No”

Click Next.

Step 4

The first case of data begins on which line number?

Answer: 1 (likely defaults to 1 – if so leave it)

How many lines represent a case?

Answer: 1 (likely defaults to 1 – if so leave it)

How many cases do you want to import?

Select  “All of the cases” (unless you wish to analyze cases according to a percentage etc)

Click next.

Step 5

Now you must have your Data Dictionary handy. Please refer to R:data\Project_Number\docs\data dictionary where you will find an excel file called the Data Dictionary. This file describes the layout of each of your data files.

Note: Most files have only one layout, but for other files (eg. Hospital Separations) you will notice that there are various layouts depending on the year of data.

The first variable will start at position 0 then following the instructions on the Dialogue box you can either enter the Column Number and click to insert a break one at time or you can double click on the position. These break numbers are clearly noted for each variable in your Data Dictionary. The “Stop” position is what you would enter in the Column Number Box.

Example:
Dummy Data Dictionary

Start Stop Length Fieldname Notes
1 3 3 Postal_Code (3 digit) Eg. Enter the column number 3 and click Insert Break
4 7 4 Source Eg. Enter the column number 7 and click Insert Break
8 9 2 Version Eg. Alternatively, double click at the 9 position
10 19 10 Sequence_Number Eg. Alternatively, double click at the 19 position
20 29 10 Study_ID etc
30 30 1 Line_Feed Line feed will be noted in your Data Dictionary, there is no need to delineate line feed during this step.

 

Sample Import Dialogue:

Once you have inserted a break for all of the data fields in your Data Dictionary click Next.

Step 5

Click on V1 and Type in the Variable name as given in your Data Dictionary.

Note: Spaces are not recognized so for Postal Code you should enter Posta_Code or postal_code etc.

Select the Data format – Select “String” from the dropdown unless you are certain that the variable should be treated as a number (this will depend on your analysis).

To enter the next variable name and data format click on the next column in the Data Preview.

E.g.

Once you have named each variable and selected the data format for each variable, click Next.

Step 6

Would you like to save this file format for future use?

Select “yes” and save in your directory of choice.  You can call this file something like “Hospital_A_Layout”. The name will depend on the Data File you are working with and the Layout, which depends on the years of data – Refer to your Data Dictionary.

Note: You will need to use this Layout file for all relevant years of data. That is, all years that refer to the same data layout. Use your Data Dictionary as a guide.

Once you have saved the layout click Finish.

Your data should open up as you see below.

Next steps

To load the next year of unzipped data.  Go to the File Menu and choose “Read Text Data”

A dialogue will open prompting you to select the next *.txt file that you would like to load. Choose your unzipped data for the subsequent year (or next data file you would like to load).

The Text Import Wizard Dialogue box Step 1 of 6 will open (you should recognize this from above). Only this time select “yes” from the prompt “does your text file match a predefined format?”

Browse to where you saved the file format/layout in Step 6 above.

Click Finish and you should be brought to Step 6 again where you can double check that the data is delineated in the layout format you have already created.

Click Finish again to open your data in the “Data Editor”

Continue this until you have loaded all of the data you need to work with for that specific Layout. When you are ready to move on to a new file layout, start again at the top of this document.

If you have any questions please contact the Researcher Liaison Unit at rlu@popdata.bc.ca