Most students genuinely hate using the program. After all, it is a rather complicated and time consuming program. In this blog, I willl try and help the lot of you by suggesting the use of syntax!
So far, my fellow students have gone through a great deal of pain in their efforts of using the SPSS drop-down menus. Especially when doing long analyses, using these menus can be tedious and cause problems in your data-file. Using syntax helps you record what you did (which commands you ran).In addition to that, when you make a mistake halfway through your analyses, there is no need to start all over again! Just scroll through the syntax to find the mistake, adjust it, and run the (part of the) syntax again. Problem solved!
For a good explanation into the basic functions of syntax, have a look at the video.
So far,universities hardly ever support the use of syntax. SPSS teachers are not always familiar with the use of it. Therefore, in the next few lines I will provide you with some suggestions on how to start using syntax.
Start by opening your SPSS dataset (.sav file). Next, use the menu drop-down to adjust your dataset as you would normally do. However, instead of clicking the 'OK' button when you have finished entering the transformations, click 'Paste'. SPSS pastes the command you gave into a blank syntax file. Now, run the transformation by selecting it and pressing 'Control R' on your keyboard. SPSS will now run the transformation as normal, but you have a record of what you did. The syntax output could for example look like this:
RECODE edu_work (1=1) (2=2) (3=3) (4=1) (5=2) (6=3) (9=9) INTO Educatin.
EXECUTE.
When you notice you have misspelled Education, adjust the spelling of the variable, select the command and press 'Control R' again. SPSS does not get any easier than that! Next, you want to recode a different variable the same way. Just select the command in the syntax file, enter, press 'Control C' and change the input and/or output variable. If you continue experimenting with this method, you will soon enough find that you can type the commands from your head and that it indeed saves time and effort! Do not forget to end every command with a dot (.) and regularly save your syntax-file & dataset.
A few basic command lines:
So far,universities hardly ever support the use of syntax. SPSS teachers are not always familiar with the use of it. Therefore, in the next few lines I will provide you with some suggestions on how to start using syntax.
Start by opening your SPSS dataset (.sav file). Next, use the menu drop-down to adjust your dataset as you would normally do. However, instead of clicking the 'OK' button when you have finished entering the transformations, click 'Paste'. SPSS pastes the command you gave into a blank syntax file. Now, run the transformation by selecting it and pressing 'Control R' on your keyboard. SPSS will now run the transformation as normal, but you have a record of what you did. The syntax output could for example look like this:
RECODE edu_work (1=1) (2=2) (3=3) (4=1) (5=2) (6=3) (9=9) INTO Educatin.
EXECUTE.
When you notice you have misspelled Education, adjust the spelling of the variable, select the command and press 'Control R' again. SPSS does not get any easier than that! Next, you want to recode a different variable the same way. Just select the command in the syntax file, enter, press 'Control C' and change the input and/or output variable. If you continue experimenting with this method, you will soon enough find that you can type the commands from your head and that it indeed saves time and effort! Do not forget to end every command with a dot (.) and regularly save your syntax-file & dataset.
A few basic command lines:
- GET FILE="C:\Documents and Settings\Etc\file_x.sav". ----- Connect your syntax-file to your dataset.
- SAVE OUTFILE="C:\Documents and Settings\Etc\file_x1.sav". ----- Save your dataset.
- FRE [variable_x]. ----- Provides you with a frequency table.
- CROSS [variable_x] BY [variable_y].
- EXE. ----- Execute your command with 'Control R'.