Quantcast
web
	analytics
SPSS syntax commands are easy to write using its syntax window

Frequently used SPSS syntax commands

What are the SPSS syntax commands?

Nowadays, SPSS software is very famous for data analysis. SPSS meaning is Statistical Package for Social Sciences. SPSS syntax commands are the way to open files, edit data, generate results and save files using its syntax window. Although you can do these things using drop-down menus, syntax makes them easier. Sometimes it becomes easier to generate results using a simple command syntax. On the other hand, generating the same result using drop-down menus is very difficult. Use of syntax also saves your time. It’s just the matter of opening the syntax editor, writing the command and running it. Writing commands means writing a set of rules. Today we are going to discuss some frequently used SPSS syntax commands.

SPSS syntax commands are easy to write using its syntax window

How to create a new syntax to write SPSS syntax commands?

In SPSS statistical software, creating a new syntax is very easy. First of all, you have to open the SPSS data editor window clicking on the SPSS application. Select File-> New-> Syntax. SPSS will take you into its syntax editor. This is the editor where you can write your required command (set of rules) and run it to produce the desired output. To run SPSS syntax commands you have to select the command and click on the symbol of the green right arrow on the Syntax Editor.

SPSS syntax commands are easy to write using its syntax window

How to write SPSS syntax commands?

In SPSS software, writing SPSS syntax commands are really very much interesting. In the beginning, you can study the commands that SPSS uses to open files, edit data, generate results and save files. I am showing how to get the command to open a file. Open the SPSS data editor window clicking on the SPSS application. Select File-> Open-> Data. Select the file that you want to open browsing the Look in option in the Open Data window. Then click on Paste. SPSS will take you into its Syntax Editor and show you the command used to open the file. In this way you can study the commands for editing data, generating results and saving files.

SPSS syntax commands are easy to write using its syntax window

SPSS syntax commands are easy to write using its syntax window

1) The command to open file:

Suppose your desired file is saved in the E Drive of your PC and you have named it as 07082015_2.sav. Then the command for opening the 07082015_2.sav file is:

GET
FILE=’E:\SPSS\07082015_2.sav’.
DATASET NAME DataSet1 WINDOW=FRONT.

2) The command for saving a file:

Suppose you just created an SPSS file and you want to save it in the SPSS folder in the E Drive of your PC naming as 07082015_2.sav. Then the command for saving the 07082015_2.sav file is:

SAVE OUTFILE=’E:\SPSS\07082015_2.sav’.

3) The command for frequency distribution:

Suppose you want to generate the frequency distribution of variable1. Then the command for generating the frequency distribution of variable1 is:

FREQUENCIES VARIABLES=variable1
/ORDER=ANALYSIS.

4) The command for cross-tabulation:

Suppose you have two variables – variable1 and variable2. You want to generate the cross-tabulation of these 2 variables. Then the command for generating the cross-tabulation of variable1 and variable2 is:

CROSSTABS
/TABLES=variable1 BY variable2
/CELLS=COUNT
/COUNT ROUND CELL.

5) The command for creating value labels:

Suppose you have a variable – Company and this variable contain 3 values – 1, 2 and 3. You want to generate the value labels – Company 1, Company 2 and Company 3 for a new variable CompanyID. Then the command for generating the value labels – Company 1, Company 2 and Company 3 is:

COMPUTE CompanyID=Company.

val lab CompanyID
1 ‘Company 1’
2 ‘Company 2’
3 ‘Company 3’.

EXECUTE.

BatteryClerk.com

Summary
Frequently used commands in SPSS
Article Name
Frequently used commands in SPSS
Description
Command in SPSS is the way to open files, edit data, generate results and save files using its syntax window. Although you can do these things using drop-down menus, syntax makes them easier. Sometimes it's possible to generate results using a simple command in syntax whereas generating the same result using drop-down menus is very difficult. Use of syntax also saves your time. It's just the matter of opening the syntax editor, writing the command and running it. Writing commands means writing a set of rules. Today we are going to discuss about some frequently used commands in SPSS.
Author
Publisher Name
LEARN AND EARN
Publisher Logo