Use the SPSS Wizard to Read an ASCII File
The SPSS Wizard for reading files will open automatically if you read in a text file.
- Fixed Format
File Requirements: file has- one record per case
- on each record the variables have the same starting and ending position
- easiest to use when data in each field does not fill the field
- not recommended for tightly packed data in lengthly records
- Fixed Format - suited to the Wizard
Use file spss-tryit.txt. The accompanying documentation is spss-tryit.doc (you many not need it)
Instruct SPSS to ignore the header rows (there are many of this before you get to data in fixed columns...look for the data rows.
Every field in the SPSS file that you are creating needs to be numeric except for fields that are the component of Area Key, state (2 digits) and county (3 digits)s. In input they are in one field, in the SPSS file they need to be separate string fields.
Except for state and county, use the defaulty variable names. - Fixed Format - a more difficult format
Download the file spss-polljan13.dat. Use the print documentation to help you define the file with the SPSS Wizard.
As you can see from then list of file types, SPSS can open files in many formats.
Find the DataGate Study for census data from Pakistan.
Download the area population table for the North-West Frontier Province.
Try opening it in SPSS.
Decide whether it would be easier to clean the file up in Excel or SPSS.
Once you have a usable file in SPSS, sort the data by average household size. Save the file as in SPSS portable format.
File Requirements:
- delimited files are text files where individuals fields are enclosed with a some standard character, most often comma or tab
- Files with extension .csv typically are comma delimited, that is commas between the numeric fields and " marking the text fields.
- Delimited files can be opened in by the SPSS Wizard. Try opening the file stud-cdvols-jun22-07.csv.
- Decide whether it is easier to use the wizard or to use EXCEL to convert the file to a xls first.
Read an ASCII File that is accompanied by SPSS Code
- Use ICPSR 3555. It is comprised of data, documentation and an SPSS program.
- Download the spss program. It is a text file and should have the extension .sps. Once it is downloaded, if this is not the extension, change it.
- Download the raw data file (in the list of files it has a .txt extension).
- Using the SPSS open file menu, open the syntax file and modify it so that the location specified in the NAME command points to the path and file name of the downloaded data file.
- Use the run menu to execute the program.
- If you have never use census microdata, find and read the EDS guide, Census 2000 Microdata Overview. Use the IPUMS site to extract microdata for the New York Metro area. You want to look at the travel time to work and means of transportation to work for workers. Do a cross tab between these two variables. Also get their income and if you are ambitious analyze their commuting patterns based on income.
Read an ASCII File using code you create
For instructions, use the guide " What You Need to Know to Write an SPSS Program", specifically the section on raw data.
- Files with one record per case
- Download the file (same data used in example the Wizard exercise) spss-polljan13.dat and the print documentation
- Create a syntax file containing code that reads the variables. Do not worry about value labels.
- Execute the code and save the file in either a .sav or .por format.
- Files with multiple records per case
- Use a Roper public opinion poll study comprised of a PDF codebook and a raw data file raw data file.
- Create a syntax file containing Create code that reads the file and defines variables for all the background questions (q1-q2, q53-q62), questions on upcoming election (q22-26), questions on current office holders (q27-30), county, record number and all weight variables.
- Once the file is in spss format run frequencies on a two or three variables and check it against the frequencies reported in the documentation. You may do this analysis using the windows menus or write code for it.
