banner



How To Create Syntax In Spss

Here is an example of how to run the same command using both drop-down menus and syntax. Although we could choose any command, we will run a simple descriptives command on the variable heightin our sample data set.

Getting Descriptive Statistics Using the Drop-down Menus

To run the Descriptives command using the drop-down menus, clickAnalyze > Descriptive Statistics > Descriptives.

From the left menu, select the variable(s) you wish to run the descriptives command on, and use the arrow button to move them to the Variable(s) box. In this example, we select the variable Height. Click OK.

The results for the command will appear in the Output Viewer window.

Notice that there is also syntax printed above the descriptive statistics in the output. The syntax provides a text-based map of the command we just ran using drop-down menus. If we had executed this syntax in a Syntax Editor window instead, we would get the exact same results as we did using the drop-down menu.

Getting Descriptive Statistics Using Syntax

Let's now use syntax to run the same Descriptives procedure as before.

Reopen the Descriptives procedure. All of your previous settings should still be active. Instead of clicking OK, click Paste. This should open a new Syntax Editor file with the descriptives syntax in it. (Alternatively, you can create a new syntax file by clicking File > New > Syntax, and typing or copy/pasting the following syntax into that window.)

Notice that that the text in the syntax editor appears in certain colors, and some words become bold. These stylistic formats simply define different parts of the syntax command.

DESCRIPTIVES VARIABLES= Height
/STATISTICS=MEAN STDDEV MIN MAX.

When you are finished typing the syntax, you need to tell SPSS to run the command by clicking the green arrow at the top of the window. Voila! We have produced the very same output using both drop-down menus and syntax.

Note: You can copy the syntax from an output window and paste it into a new Syntax Editor window to re-use, modify, and save the syntax. To copy syntax from the output (in the Output Viewer window), simply click the syntax, copy it, and paste it into a Syntax Editor window.

Modifying Syntax

Once you have syntax in the Syntax Editor window, you are free to modify the syntax and/or save it. For example, perhaps I decide that I want to look at some different variables, English and Writing, and I would like to get the range statistic instead of the minimum and maximum. I can easily modify the syntax I already have to accommodate these changes:

DESCRIPTIVES VARIABLES= English Writing
/STATISTICS=MEAN STDDEV RANGE .

Now when SPSS runs the descriptives command, it shows the range, mean, and standard deviation for the variables English and Writing.

How To Create Syntax In Spss

Source: https://libguides.library.kent.edu/SPSS/Syntax#:~:text=To%20open%20a%20new%20Syntax,syntax%20directly%20in%20this%20window.

Posted by: inmansomper.blogspot.com

0 Response to "How To Create Syntax In Spss"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel