Unit 2 - Syntax: Objectives
Unit 2 - Syntax: Objectives
Objectives
To successfully complete this learning unit, you will be expected to:
1.
2.
3.
Learning Activities
u02s1 Studies
Readings
Use your SPSS Essentials: Managing and Analyzing Social Sciences Data text to complete the following:
Chapter 3, "Types of Data" pages 1723. Look for important information on the "Data View" and
"Variable View" tabs at the lower right corner of the SPSS screen. Be sure you understand the
important difference between string variables and numeric variables.
Chapter 4, "Creating and Accessing Data Files (Part I)" pages 2534. Look for important information
on how to write syntax code to create data files.
Response Guidelines
Respond to one learner. Discuss your experience with syntax programs. How could this function be improved in the
future?
Resources
2.
3.
2.
3.
4.
5.
6.
7.
o Download the file Unit2_datalist.txt and open it in Notepad. In your text, you will notice there are
always two sub-commands in the "data list free" command named "begin data" and "end data."
Copy and paste the 12 lines of data from the Unit2_datalist.txt file into the first line after the
"begin data" sub-command. Make sure the "end data." statement is on the first line following the
last line of data from the downloaded file. That is, there should be no blank lines between "begin
data" and "end data."
o Run the syntax you have created. This is accomplished by pulling down the RUN menu, and
selecting "Run All". Note that you can run only part of the syntax listed in the syntax window by
selecting only a part of it in the window and using the "Selection" option under RUN. This
method will come in handy later in the course. After running your syntax, the data file should
appear in the SPSS Data Editor.
o Create a SAVE OUTFILE command to save the new data file you have created, using
the PASTE button. After running your syntax in the previous step to create your data file, go to
the Data Editorwindow to view your data file. It should look like a spreadsheet with your variable
names at the top of the columns. Use the FILE and SAVE AS menus at the top left of the SPSS
screen to select options to save your data file in the Unit2 subfolder inside of your psy7615
directory. Name the file unit2_data.sav. After you have typed the file name in the dialog box,
notice that you have the option to either SAVE or PASTE. Select the PASTE option. Now, go to
the Syntax Editor, where your original syntax to create the data file was typed. Notice that
SPSS has written a SAVE OUTFILEcommand for you under your original syntax. It did that
when you hit the PASTE button. Select this new syntax code with your mouse, pull down
the RUN menu, and click Selection. Your data file will be saved to the directory you specified in
the "Save As" dialog box, which you should notice is the same as the path in your SAVE
OUTFILE command. Now, save your new syntax file again so that your SAVE
OUTFILE command is included at the bottom of the syntax file you submit with your assignment.
o Save your syntax file to your Unit2 subfolder by opening the Syntax Editor window, pulling down
the FILE menu, and selecting SAVE AS. Navigate to your Unit2 subfolder, name the
fileunit2_syntax.sps, and save it.
Attach the following files to your assignment and upload them:
o unit2_data.sav
o unit2_syntax.sps
Resources
"Unit2_datalist.txt".