The Very Basics of SPSS(ver.16 and up,Windows) ÷y Statistical Computing Group Research Data Services SAS,University of Pennsylvania Last modified:03/16/2009 This online seminar is to help you get started with basic data management and analysis in SPSS It is for those people who: Are new to statistical data work and want to learn to use SPSS to manage data and perform common analysis. Took some undergraduate(or perhaps some graduate)introductory statistics course in SPSS long ago and want to refresh their memory. SPSS is one of the most user-friendly commercial statistical packages.As such,even beginners of statistical analysis would find its point-and-click and dialogue boxes interface very approachable and easy to use.However,in the long run,you will benefit a lot more by learning SPSS by SPSS Syntax.The pros of the syntax approach are: An efficient way for documentation and reproducibility (this is the reason I would strongly discourage you from keeping relying on the point-and-click approach). Much quicker and efficient once you learn how to write and run syntax commands. Can perform things unavailable/inaccessible from the point-and-click menus So,this online seminar attempts to prepare you for writing syntax commands yourself in the future to perform simple data tasks and run basic procedures. Aside from this online seminar,you have access to a lot of great instructional SPSS resources online for free.We strongly recommend that you use those resources to the full. This online seminar assumes that you are using SPSS ver.16 and up.Be aware there are some significant changes between ver.15 and before and ver.16 on. Contents: 1.Getting Started:Let's Open SPSS and Bring in Data............ 2 2.How to Get Descriptive Statistics and Graphs...... 14 3.How to Define Variable Properties.................... 29 4.How to Create and Recode Variables3 5.How to Subset (Select)Data........... 45 6.How to Sort and Split Data........................ 53 7.Simple Regression Example.......... 57
The Very Basics of SPSS (ver.16 and up, Windows) Statistical Computing Group @ Research Data Services SAS, University of Pennsylvania Last modified: 03/16/2009 This online seminar is to help you get started with basic data management and analysis in SPSS. It is for those people who: Are new to statistical data work and want to learn to use SPSS to manage data and perform common analysis. Took some undergraduate (or perhaps some graduate) introductory statistics course in SPSS long ago and want to refresh their memory. SPSS is one of the most user-friendly commercial statistical packages. As such, even beginners of statistical analysis would find its point-and-click and dialogue boxes interface very approachable and easy to use. However, in the long run, you will benefit a lot more by learning SPSS by SPSS Syntax. The pros of the syntax approach are: • An efficient way for documentation and reproducibility (this is the reason I would strongly discourage you from keeping relying on the point-and-click approach). • Much quicker and efficient once you learn how to write and run syntax commands. • Can perform things unavailable/inaccessible from the point-and-click menus. So, this online seminar attempts to prepare you for writing syntax commands yourself in the future to perform simple data tasks and run basic procedures. Aside from this online seminar, you have access to a lot of great instructional SPSS resources online for free. We strongly recommend that you use those resources to the full. This online seminar assumes that you are using SPSS ver.16 and up. Be aware there are some significant changes between ver.15 and before and ver.16 on. Contents: 1. Getting Started: Let’s Open SPSS and Bring in Data................................................................. 2 2. How to Get Descriptive Statistics and Graphs.......................................................................... 14 3. How to Define Variable Properties........................................................................................... 29 4. How to Create and Recode Variables....................................................................................... 33 5. How to Subset (Select) Data..................................................................................................... 45 6. How to Sort and Split Data ....................................................................................................... 53 7. Simple Regression Example ..................................................................................................... 57 1
1.Getting Started:Let's Open SPSS and Bring in Data In this section,we will play with the SPSS windows and get a broad idea of what things look like in the SPSS environment.In so doing,we also learn how to bring data in SPSS.By the end of this section we will have a rough but good idea what role each window plays for your data management and analysis work and how to get SPSS ready for our work. First,let's create a working directory for this practice in whatever location you prefer.It is always a good idea to keep one project directory for one project.Let's call this new working directory "verybasicSPSS."Then download from here the data files we are going to use in this online workshop.Save them in the working directory you just created. Now,let's launch the program. Click on the SPSS icon,OR Choose from Window's Start menu SPSS 1x.x (whatever version you have;this workshop is using Version 16)for Windows: Start Programs SPSS for Windows SPSS 1x.x for Windows Some of you may have a dialogue box (called"SPSS for Windows 1x.x [your version]")popping up asking"What would you like to do?".In that case,let's just click on"Cancel"for now and go see what windows we have in the SPSS interface. You should be seeing an untitled SPSS Data Editor window now(like below). Untitled1 [DataSeto]-SPSS Data Editor -▣ File Edit View Data Iransform Analyze Graphs Utilities Add-ons Vindow Help 公周昌 厚卧:的帽由昌办雪多©● 1 Visible:0 of 0 Variables var var var var var var var 2 3 Data View Variable View SPSS Processor is ready The Data Editor window shows you the working(=currently open)dataset in a spreadsheet format.Of course,it is now new and empty.You see there are two sheets in this window,the Data View and the Variable View.Currently,the Data View is active (in yellow).You see a message from SPSS at the bottom of the window.Currently,it is "SPSS Processor is ready"for your work. 2
1. Getting Started: Let’s Open SPSS and Bring in Data In this section, we will play with the SPSS windows and get a broad idea of what things look like in the SPSS environment. In so doing, we also learn how to bring data in SPSS. By the end of this section we will have a rough but good idea what role each window plays for your data management and analysis work and how to get SPSS ready for our work. First, let’s create a working directory for this practice in whatever location you prefer. It is always a good idea to keep one project directory for one project. Let’s call this new working directory “verybasicSPSS.” Then download from here the data files we are going to use in this online workshop. Save them in the working directory you just created. Now, let’s launch the program. Click on the SPSS icon, OR Choose from Window’s Start menu SPSS 1x.x (whatever version you have; this workshop is using Version 16) for Windows: Start Programs > SPSS for Windows > SPSS 1x.x for Windows Some of you may have a dialogue box (called “SPSS for Windows 1x.x [your version]”) popping up asking “What would you like to do?”. In that case, let’s just click on “Cancel” for now and go see what windows we have in the SPSS interface. You should be seeing an untitled SPSS Data Editor window now (like below). The Data Editor window shows you the working (= currently open) dataset in a spreadsheet format. Of course, it is now new and empty. You see there are two sheets in this window, the Data View and the Variable View. Currently, the Data View is active (in yellow). You see a message from SPSS at the bottom of the window. Currently, it is “SPSS Processor is ready” for your work. 2
Before getting started with our work,let's change the output settings.From the menu bat at the top (of whichever window), Edit Options... This will bring you the "Options"dialogue box.Here,you can control what to display in your output.Click the"Viewer"tab.Here is one setting I strongly recommend that you choose: "Display commands in log."You will see why in a moment.For now,just check the box and click OK 团0 ptions General Viewer Data Currency Ouput Labels Charts Pivot Tables File Locations Scripts Initial Output State Title tem lcon Font Size: SansSerif Log 习49B☑四■ Shown Page Title Hidden Font Size: SansSerif 习09B四■ Justification Almn n 唱 Center Text Output ○Align g Fo吨 Size Monospaced 习o9B1四■ Display commands in the log OK Cancel apply Help Now,let's first bring in a data.We'll use these files for this practice. xls gss93.xls csv_gss93subset.csv fix gss93subset.dat GSS93 subset.sav *The second and third files are subsets of the last one"GSS93 subset"data(7 variables,97 observations)in different formats for our practice purpose. Reading Data from Excel Files We will start with importing the excel file"xls_gss93subset.xls"into SPSS.First,open the excel file and understand how it is formatted.The first row has variable names,and the data part is from the second row and below.Close the excel file and let's start reading this file into SPSS 3
Before getting started with our work, let’s change the output settings. From the menu bat at the top (of whichever window), Edit Options… This will bring you the “Options” dialogue box. Here, you can control what to display in your output. Click the “Viewer” tab. Here is one setting I strongly recommend that you choose: “Display commands in log.” You will see why in a moment. For now, just check the box and click OK. Now, let’s first bring in a data. We’ll use these files for this practice. xls_gss93.xls csv_gss93subset.csv fix_gss93subset.dat GSS93 subset.sav * The second and third files are subsets of the last one “GSS93 subset” data (7 variables, 97 observations) in different formats for our practice purpose. Reading Data from Excel Files We will start with importing the excel file “xls_gss93subset.xls” into SPSS. First, open the excel file and understand how it is formatted. The first row has variable names, and the data part is from the second row and below. Close the excel file and let’s start reading this file into SPSS. 3
Start SPSS by clicking on the SPSS icon or from the Window's Start menu.From the SPSS menu bat at the top,go: File Open Data.… Untitled1 [DataSeto]-SPSS Data Editor 回 Eile Edit Yiew Data Iransform Analyze Graphs Utilities Add-ons Window Help New Open A 用a Visible:0 of 0 Variables Open Database Syntex.… var var var □Read Text Data. output. 当goee Ctrl-F4 @sgrt… 目ss8 ctri-S Save As. 日Save All Data Export to Database SPSS Processor is ready This brings up a dialogue box"Open Data"as shown below.Go to your working directory “verybasicSPSS,”then select“Excel(*.xls)”format from“Files of type.”Then select the excel file"xls gss93.xls"you saved there.Then click Open.(see below for a visualized instruction). Open Data Look in: verybasicSP 电峰盟g (1)Go to your working 国s9ss93x5 directory where you saved the excel file. Recent (3)Select this file. G Desktop 自 My Documents (2)“-Files of type'”is (4)Click Open. Excel.This brings up 9 our excel file in the above window. My Computer File name: x×sg3s93.sav Open Files of type: Excelxs,*xsX*Xsm) Paste My Network Places Mnimize string widths based on observed values Cancel Now you should be seeing another dialogue box"Opening Excel Data Source
Start SPSS by clicking on the SPSS icon or from the Window’s Start menu. From the SPSS menu bat at the top, go: File Open Data… This brings up a dialogue box “Open Data” as shown below. Go to your working directory “verybasicSPSS,” then select “Excel (*.xls)” format from “Files of type.” Then select the excel file “xls_gss93.xls” you saved there. Then click Open. (see below for a visualized instruction). (4) Click Open. (3) Select this file. (2) “Files of type” is Excel. This brings up our excel file in the above window. (1) Go to your working directory where you saved the excel file. Now you should be seeing another dialogue box “Opening Excel Data Source.” 4
Opening Excel Data Source D:Documents and SettingsrrumimDesktopStatsisp1_verybasicSPsp1_verybasicSP_wrkfilewerybasicSPils_gss93.xls Read variable names from the first row of data Worksheet: xis gss93[A1:B01501] Range: Maximum width for string columns: 32767 Continue Cancel Help As we first checked,the excel file has variable names in the first row.So check the "Read variable names from the first row of the data"box.Click OK.Now you have a new,unsaved data in another SPSS Data Editor window.To save the data in the SPSS format,go from the pull- down menu: File Save Let's save it in your working directory with the name"xls gss93."Let's keep this data for a moment. Reading Data from Text Files (comma-separated-values) Okay,we are next try importing"csv_gss93subset.csv,"a text file in the comma separated values format.The first line contains variable names.From the menu bar at the top, File Open Data.… This again should bring up a dialogue box called"Open Data.Make sure you are looking in your working directory "verybasicSPSS."Since our file extension is.csv,we need to select"All Files(*.*)”from“Files of type.”Then“csv gss93 subset..csv”shows up in the window.Select it and click Open
As we first checked, the excel file has variable names in the first row. So check the “Read variable names from the first row of the data” box. Click OK. Now you have a new, unsaved data in another SPSS Data Editor window. To save the data in the SPSS format, go from the pulldown menu: File Save Let’s save it in your working directory with the name “xls_gss93.” Let’s keep this data for a moment. Reading Data from Text Files (comma-separated-values) Okay, we are next try importing “csv_gss93subset.csv,” a text file in the comma separated values format. The first line contains variable names. From the menu bar at the top, File Open Data… This again should bring up a dialogue box called “Open Data.” Make sure you are looking in your working directory “verybasicSPSS.” Since our file extension is .csv, we need to select “All Files(*.*)” from “Files of type.” Then “csv_gss93subset.csv” shows up in the window. Select it and click Open. 5
图Open Data Look in: verybasicSP 国腾88= csv gss93subset.crv fix_gss93subset da Recent GSS93 subset.sav 国xs9ss93,sav G xis_gss93 xls Desktop 的 My Documerts 9 My Computer Fle name: csv_gss93subset.csv Open g Fles of type: All Files(体) Paste My Networlc Places Minimize string widths based on observed values Cancel Then the "Text Import Wizard"dialogue box shows up,which has six steps.Click Next,and in Step 2 of 6,check on the"Yes"radio button to the question"Are variable names included at the top of your file?"because we do have variable names in the first row,and else accept the default settings and keep moving on by clicking Next.Then in Step 6 of6,you will see click Finish. Text Import Wizard-Step 2 of 6 How are your variables arranged? Deimited -Variables are delimited by a specific character (i.e.,comma,tab) Eixed wictth -Variables are aligned in fixed width columns. -Are variable names included at the top of your file? Yes ON№ Text file:D:Documents and SettingsrumimDesktopStatssp1_verybasicSPisp1_verybas 10 200 id,wrkstat,marital,agewed,sibs,childs,age ,1,3,20,3,1,43 ,1,5,0,2,0,44 3,1,3,25,2,0,43 Back Next Finish Cancel Help You should see another SPSS Data Editor window [DataSet2]popping up.As is clear,multiple data files can be simultaneously open in SPSS(we'll mention about this a bit more later). Browse the one you just read in,and let's just close it without saving. 6
Then the “Text Import Wizard” dialogue box shows up, which has six steps. Click Next, and in Step 2 of 6, check on the “Yes” radio button to the question “Are variable names included at the top of your file?” because we do have variable names in the first row, and else accept the default settings and keep moving on by clicking Next. Then in Step 6 of 6, you will see click Finish. You should see another SPSS Data Editor window [DataSet2] popping up. As is clear, multiple data files can be simultaneously open in SPSS (we’ll mention about this a bit more later). Browse the one you just read in, and let’s just close it without saving. 6
Reading Data from Text Files (ASCII fixed format) Finally,let's practice reading the data "fix gss93subset.dat,"which is an ASCII fixed format file. This type of data always comes with a codebook that specifies which column corresponds to which variable.Take a look at this text file (left below;notice there is no variable name header) and its codebook(right below) 113203143 Variable Name Column Number 21502044 313252043 id 1-4 42504045 wrkstat 5 55501078 marital 6 651252283 711222255 agewed 7-8 851243275 sibs 9-10 913221231 childs 11 102501054 age 12-13 Now,unlike the previous examples,there is no easy point-and-click method to read this type of data.What do we do then?The best way is to write syntax commands ourselves to bring in this data.Let's open a new syntax file for this work.From the menu bar at the top,go: File New Stntax You now should be seeing the SPSS Syntax Editor,which is another important window in the SPSS environment (as I emphasized in the introduction,you should eventually learn to use and write the Syntax file for your work.You are now getting a little glimpse of it...).Let's save it as "verybasicspss"in your working directory.Now,let's type the following commands(be sure to specify the file location where you saved the file "fix gss93subset.dat"). data list fixed file='[specify your working directory]lfix_gss93subset.dat' Always end your comment with a period. id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13.- The command DATA LIST is to read a text format data file by assigning names and formats to each variable in the file.The keyword FIXED follows to tell SPSS that our data is a fixed format (actually,this is the SPSS default so you can skip it).The command FILE ="file location/name here"specifies your fixed format file and its location.After the slash(/)we provide SPSS with variable definitions(the variable names and column numbers)from the codebook. Two syntax rules you must remember here: 1.Notice that the whole command ended with a period (".")In SPSS,each command in SPSS must be completed with a period“.”. 2.SPSS Syntax is NOT case-sensitive
Reading Data from Text Files (ASCII fixed format) Finally, let’s practice reading the data “fix_gss93subset.dat,” which is an ASCII fixed format file. This type of data always comes with a codebook that specifies which column corresponds to which variable. Take a look at this text file (left below; notice there is no variable name header) and its codebook (right below). 11320 3143 215 0 2044 31325 2043 425 0 4045 555 0 1078 65125 2283 71122 2255 85124 3275 91322 1231 1025 0 1054 Variable Name Column Number id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13 Now, unlike the previous examples, there is no easy point-and-click method to read this type of data. What do we do then? The best way is to write syntax commands ourselves to bring in this data. Let’s open a new syntax file for this work. From the menu bar at the top, go: File New Stntax You now should be seeing the SPSS Syntax Editor, which is another important window in the SPSS environment (as I emphasized in the introduction, you should eventually learn to use and write the Syntax file for your work. You are now getting a little glimpse of it…). Let’s save it as “verybasicspss” in your working directory. Now, let’s type the following commands (be sure to specify the file location where you saved the file “fix_gss93subset.dat”). data list fixed file='[specify your working directory]\fix_gss93subset.dat' / id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13. Always end your comment with a period. The command DATA LIST is to read a text format data file by assigning names and formats to each variable in the file. The keyword FIXED follows to tell SPSS that our data is a fixed format (actually, this is the SPSS default so you can skip it). The command FILE = “file location/name here” specifies your fixed format file and its location. After the slash (/) we provide SPSS with variable definitions (the variable names and column numbers) from the codebook. Two syntax rules you must remember here: 1. Notice that the whole command ended with a period (“.”). In SPSS, each command in SPSS must be completed with a period “.”. 2. SPSS Syntax is NOT case-sensitive. 7
*verybasicspss.SPS-SPSS Syntax Editor ▣x File Edit View Data Transform Analyze Graphs Utilities Run Add-ons Window Help 公日凸回物◆国昼: % ■层+ Active: DataSet1 data list fixed file='[Specify your working directory]w Run Current fix gss93subset.dat' id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13. Run current command SPSS Processor is ready In 52 Col 1 Now,let's execute our commands.First,highlight them,then to run the highlighted part,hit the Run Current button or alternatively hit Ctrl+R keys.When you run the above command, another Data Editor window should open for this new data.But what did you get there? You should be seeing a blank spreadsheet under the"*Untitled4 []"heading,although from the Variable View it looks like SPSS seems to have variable information.Why aren't we seeing the data itself? To read the data,we need to run another command to actually use this data(because to use this data,SPSS needs to read it!).Get back to your Syntax Editor,and first make sure we are working on this data set. This pull-down menu verybasicspss.SPS-SPSS Syntax Editor indicates your active data source. File Edit View Data Iransform Analyze Graphs Utilities Run Add-ons 卫p 公昌马四。→□兰岳:4色●%■, Active:Unnamed When you have multiple data files open at the same time,you need to tell SPSS which data file you are working on (which is called "Active"file).You can make your file active by simply clicking anywhere in the Data Editor window of the data you want to use(in this case, *Untitled4[),or when you have your Syntax Editor open,you can use the pull-down menu(in this case,it should be set to "Unnamed"since"*Untitled4 []"is neither saved nor named). Once you make sure"*Untitled4 []"is active,type in the following command(don't forget a comma),highlight and run it. list. Now,what do you have in your Data Editor and Output Viewer?You should now be seeing the data content in the Editor,and the command LIST is executed and the result is in the Output Viewer The point is this:SPSS just keeps it in its memory and does not read the data until it needs to, because that's efficient in terms of processing.In this example,SPSS encounters the procedural command LIST,realizes it needs the data"*Untitled4 []"to execute LIST and produce results on that data,and only at that moment does it read in the data. 8
Now, let’s execute our commands. First, highlight them, then to run the highlighted part, hit the Run Current button or alternatively hit Ctrl + R keys. When you run the above command, another Data Editor window should open for this new data. But what did you get there? You should be seeing a blank spreadsheet under the “*Untitled4 []” heading, although from the Variable View it looks like SPSS seems to have variable information. Why aren’t we seeing the data itself? To read the data, we need to run another command to actually use this data (because to use this data, SPSS needs to read it!). Get back to your Syntax Editor, and first make sure we are working on this data set. This pull-down menu indicates your active data source. When you have multiple data files open at the same time, you need to tell SPSS which data file you are working on (which is called “Active” file). You can make your file active by simply clicking anywhere in the Data Editor window of the data you want to use (in this case, “*Untitled4 []”), or when you have your Syntax Editor open, you can use the pull-down menu (in this case, it should be set to “Unnamed” since “*Untitled4 []” is neither saved nor named). Once you make sure “*Untitled4 []” is active, type in the following command (don’t forget a comma), highlight and run it. list. Now, what do you have in your Data Editor and Output Viewer? You should now be seeing the data content in the Editor, and the command LIST is executed and the result is in the Output Viewer. The point is this: SPSS just keeps it in its memory and does not read the data until it needs to, because that’s efficient in terms of processing. In this example, SPSS encounters the procedural command LIST, realizes it needs the data “*Untitled4 []” to execute LIST and produce results on that data, and only at that moment does it read in the data. 8
But suppose you want to explicitly force a data pass so that you can immediately see the read-in data in the Data Viewer.The command EXECUTE does that for you.If you run the following, data list fixed file='[specify your working directory]lfix_gss93subset.dat' id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13. execute. then you would immediately see the result in your Data Editor without running any procedural command.EXECUTE forces all the data to pass(including the data transformation, where you for example create or recode variables and need to read the new data with those new variables so you can use them),but it does nothing else to the session.It just forces a data pass. But as I said,SPSS reads the data as it needs to after all,so in most cases EXECUTE is rarely if ever necessary.In fact,to use EXECUTE at every single data transformation command slows down the processing because SPSS is forced to read the data at every single EXECUTE,even when data reading is unnecessary at that moment.So you should use EXECUTE sparingly.We will be back to this command later and discuss a couple of situations where you absolutely must run EXECUTE. Anyway,let's take a look at our output. *Output1 [Document1]-SPSS Viewer Fle Edt View Data Iransform Insert Format Analyze Graphs Ltities Add-ons We checked“Display commands in log” 色日色B回的中回品屏卧:●后阳增做帝和 in the Options menu,so SPSS displays 日*图Output Read ASCII file (fixed forma the syntax it ran on the output 色L0g data list fixed file='D: 白图List \Documents and Settings\rumim\Desktop\Stat etybasicSP\ap1 verpbasicSP wrkr 一回Title set.dat 高Notes id 1-4 urkatat 5 marital 6 agewed 7-8 siba 9-10 childs 11 age 12-13 自Te对Output Data List vill read 1 records from D: \Documents and Settings\...\sp1_verybasieSp_urkfilelverybasieSp\fix_gss93subset. Variable Rec Start End Format id 4F4.0 5 F1.0 marital 6 F1.0 ageved F2,0 sibs 1 10 F2.0 childs 11 F1.0 age 1 13 F2.0 113t, List marital ageved sibs childs age 20 3 1 43 0 2 0 44 4 SPSS Processor is ready 9
But suppose you want to explicitly force a data pass so that you can immediately see the read-in data in the Data Viewer. The command EXECUTE does that for you. If you run the following, data list fixed file='[specify your working directory]\fix_gss93subset.dat' / id 1-4 wrkstat 5 marital 6 agewed 7-8 sibs 9-10 childs 11 age 12-13. execute. … then you would immediately see the result in your Data Editor without running any procedural command. EXECUTE forces all the data to pass (including the data transformation, where you for example create or recode variables and need to read the new data with those new variables so you can use them), but it does nothing else to the session. It just forces a data pass. But as I said, SPSS reads the data as it needs to after all, so in most cases EXECUTE is rarely if ever necessary. In fact, to use EXECUTE at every single data transformation command slows down the processing because SPSS is forced to read the data at every single EXECUTE, even when data reading is unnecessary at that moment. So you should use EXECUTE sparingly. We will be back to this command later and discuss a couple of situations where you absolutely must run EXECUTE. Anyway, let’s take a look at our output. We checked “Display commands in log” in the Options menu, so SPSS displays the syntax it ran on the output. 9
You see the data content listed.You can save your output by going from the drop-down menu. File Save As... The file extension for the SPSS output is.spv (Note:SPSS older than version 16 has the extension.spo for the output files.To open and view .spo files in SPSS version 16 or later,you need to install SPSS Legacy Viewer.For more information,see the SPSS technical support website).The left-side pane is SPSS's outline view of your output.It serves like a table of content and allows you to navigate different parts of your output by clicking on small output icons. You also see why I strongly recommended you set your "Options"to "Display commands in log."Notice that in the output,you see all the syntax we have run so far printed out,even those you didn't write yourself.This is why I strongly recommended that you set"Display commands in log"in the"Options"menu.First,having the actual commands you run along with the corresponding output helps you greatly with documentation.You can always see what command and options you used to generate the output that you have,and you can always keep track of exactly what you did with the data.This is very important. Further,be aware that SPSS syntax like those is running beneath the point-and-click interface, even when you simply use those pull-down menus without writing syntax commands yourself and do not see the actual commands SPSS runs.As mentioned earlier,you should eventually learn to write commands by using your Syntax Editor yourself and run them from there,instead of pointing and clicking.This is also very important for documentation and reproducibility. Had you written and run the following syntax commands yourself,you would have gotten the same results.They were the syntax running beneath your pointing and clicking Read an Excel file get data /type xls Ifile ='[specify your working directory]lverybasicSPSS\xls_gss93.xls' /sheet name "xls_gss93subset" /readnames on. execute Read a Comma-Separated-Values file get data /type txt /file ='[specify your working directory]IverybasicsPSSIcsv_gss93subset.csv' /firstcase =2 /delimiters="," /variables id f2.0 wrkstat f1.0 marital f1.0 agewed f2.0 sibs f2.0 10
You see the data content listed. You can save your output by going from the drop-down menu. File > Save As… The file extension for the SPSS output is .spv (Note: SPSS older than version 16 has the extension .spo for the output files. To open and view .spo files in SPSS version 16 or later, you need to install SPSS Legacy Viewer. For more information, see the SPSS technical support website). The left-side pane is SPSS’s outline view of your output. It serves like a table of content and allows you to navigate different parts of your output by clicking on small output icons. You also see why I strongly recommended you set your “Options” to “Display commands in log.” Notice that in the output, you see all the syntax we have run so far printed out, even those you didn’t write yourself. This is why I strongly recommended that you set “Display commands in log” in the “Options” menu. First, having the actual commands you run along with the corresponding output helps you greatly with documentation. You can always see what command and options you used to generate the output that you have, and you can always keep track of exactly what you did with the data. This is very important. Further, be aware that SPSS syntax like those is running beneath the point-and-click interface, even when you simply use those pull-down menus without writing syntax commands yourself and do not see the actual commands SPSS runs. As mentioned earlier, you should eventually learn to write commands by using your Syntax Editor yourself and run them from there, instead of pointing and clicking. This is also very important for documentation and reproducibility. Had you written and run the following syntax commands yourself, you would have gotten the same results. They were the syntax running beneath your pointing and clicking. Read an Excel file get data /type = xls /file = ' [specify your working directory]\verybasicSPSS\xls_gss93.xls' /sheet = name "xls_gss93subset" /readnames = on. execute. Read a Comma-Separated-Values file get data /type = txt /file = '[specify your working directory]\verybasicSPSS\csv_gss93subset.csv' /firstcase = 2 /delimiters = "," /variables = id f2.0 wrkstat f1.0 marital f1.0 agewed f2.0 sibs f2.0 10