Step IISyntexSPSS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 105

Introduction to SPSS

Step-by-Step
Abdelkamel ALJ
Dpartement de Mathmatiques, Universit Libre de Bruxelles

Utilisation approfondie des logiciels statistique, 2009

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

1 / 43

Outline of step II
1

Introduction

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

2 / 43

Outline of step II
1

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

2 / 43

Outline of step II
1

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

2 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.
The use of syntax is also helpful in documenting your analysis.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.
The use of syntax is also helpful in documenting your analysis.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.
The use of syntax is also helpful in documenting your analysis.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.
The use of syntax is also helpful in documenting your analysis.

A syntax file is nothing more than a text file ; hence, you can type code and comments into
it, and you can cut-and-paste in it as you would in any text editor. To run the code that you
have pasted, you simply highlight it and click on the right-pointing arrow at the top.
The journal is a log of all of the SPSS commands that have been issued, but with no output.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Introduction

Aims and usefulness

The aim of this seminar is to help you learn about the use of SPSS syntax as an alternative
to the point-and-click interface.
The use of syntax is also helpful in documenting your analysis.

A syntax file is nothing more than a text file ; hence, you can type code and comments into
it, and you can cut-and-paste in it as you would in any text editor. To run the code that you
have pasted, you simply highlight it and click on the right-pointing arrow at the top.
The journal is a log of all of the SPSS commands that have been issued, but with no output.

One of the most important things to remember when writing SPSS syntax is that all
commands must end in a period (.).
To start a comment, use either an asterisk (*) or the command comment.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

3 / 43

Topics in Data Management

Importing data

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

4 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.
Dont forget to include the file extension.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.
Dont forget to include the file extension.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.
Dont forget to include the file extension.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.
Dont forget to include the file extension.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Importing data

Importing data
The SPSS command for opening a data file is get file followed by the path where the file is located.
Dont forget to include the file extension.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

5 / 43

Topics in Data Management

Creating numeric variables

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

6 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.
There is no then in SPSS

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.
There is no then in SPSS

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.
There is no then in SPSS

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.
There is no then in SPSS

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

Two commands that you can use to create numeric variables are compute and if.
There is no then in SPSS

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

7 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

8 / 43

Topics in Data Management

Creating numeric variables

Creating numeric variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

8 / 43

Topics in Data Management

Creating string variables

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

9 / 43

Topics in Data Management

Creating string variables

Creating string variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

10 / 43

Topics in Data Management

Creating string variables

Creating string variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

10 / 43

Topics in Data Management

Creating string variables

Creating string variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

10 / 43

Topics in Data Management

Creating string variables

Creating string variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

11 / 43

Topics in Data Management

Creating string variables

Creating string variables

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

11 / 43

Topics in Data Management

Recoding variables and Counting

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

12 / 43

Topics in Data Management

Recoding variables and Counting

Recoding variables and Counting

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

13 / 43

Topics in Data Management

Recoding variables and Counting

Recoding variables and Counting

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

13 / 43

Topics in Data Management

Recoding variables and Counting

Recoding variables and Counting

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

13 / 43

Topics in Data Management

Recoding variables and Counting

Recoding variables and Counting

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

14 / 43

Topics in Data Management

Recoding variables and Counting

Recoding variables and Counting

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

14 / 43

Topics in Data Management

Dates

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

15 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

16 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

16 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

17 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

17 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

18 / 43

Topics in Data Management

Dates

Dates

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

18 / 43

Topics in Data Management

Missing data

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

19 / 43

Topics in Data Management

Missing data

Missing data
There are two different types of missing data in SPSS :
system-missing : is displayed as a dot (.) in the column of a numerical variable.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

20 / 43

Topics in Data Management

Missing data

Missing data
There are two different types of missing data in SPSS :
system-missing : is displayed as a dot (.) in the column of a numerical variable.
user-defined missing : you can define your own missing values.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

20 / 43

Topics in Data Management

Missing data

Missing data
There are two different types of missing data in SPSS :
system-missing : is displayed as a dot (.) in the column of a numerical variable.
user-defined missing : you can define your own missing values.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

20 / 43

Topics in Data Management

Missing data

Missing data
There are two different types of missing data in SPSS :
system-missing : is displayed as a dot (.) in the column of a numerical variable.
user-defined missing : you can define your own missing values.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

20 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.
FREQUENCIES : By default, missing values are excluded and percentages are based on the number
of non-missing values. If you use the missing=listwise subcommand on the frequencies command, the
percentages are based on the total number of non-missing and user-missing values and the
percentage of user-missing values are reported in the table.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.
FREQUENCIES : By default, missing values are excluded and percentages are based on the number
of non-missing values. If you use the missing=listwise subcommand on the frequencies command, the
percentages are based on the total number of non-missing and user-missing values and the
percentage of user-missing values are reported in the table.
CORRELATIONS : By default, correlations are computed based on the number of pairs with
non-missing data (pairwise deletion of missing data). The missing=listwise subcommand can be used
on the corr command to request that correlations be computed only on observations with complete
valid data for all variables on the var subcommand (listwise deletion of missing data).

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.
FREQUENCIES : By default, missing values are excluded and percentages are based on the number
of non-missing values. If you use the missing=listwise subcommand on the frequencies command, the
percentages are based on the total number of non-missing and user-missing values and the
percentage of user-missing values are reported in the table.
CORRELATIONS : By default, correlations are computed based on the number of pairs with
non-missing data (pairwise deletion of missing data). The missing=listwise subcommand can be used
on the corr command to request that correlations be computed only on observations with complete
valid data for all variables on the var subcommand (listwise deletion of missing data).
REGRESSION : If values of any of the variables on the var subcommand are missing, the entire case
is excluded from the analysis (i.e., listwise deletion of missing data). It is possible to further control the
treatment of missing data with the missing subcommand and one of the following keywords : pairwise,
meansubstitution, or include.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.
FREQUENCIES : By default, missing values are excluded and percentages are based on the number
of non-missing values. If you use the missing=listwise subcommand on the frequencies command, the
percentages are based on the total number of non-missing and user-missing values and the
percentage of user-missing values are reported in the table.
CORRELATIONS : By default, correlations are computed based on the number of pairs with
non-missing data (pairwise deletion of missing data). The missing=listwise subcommand can be used
on the corr command to request that correlations be computed only on observations with complete
valid data for all variables on the var subcommand (listwise deletion of missing data).
REGRESSION : If values of any of the variables on the var subcommand are missing, the entire case
is excluded from the analysis (i.e., listwise deletion of missing data). It is possible to further control the
treatment of missing data with the missing subcommand and one of the following keywords : pairwise,
meansubstitution, or include.
ANOVA : Cases with any missing value are excluded from any single complete ANOVA design in which
the missing value is encountered. It is possible to specify more than one ANOVA design with a single
anova command.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

Missing data

Summary of how missing values are handled in SPSS


analysis commands
It is important to understand how SPSS commands used to analyze data treat missing
data.
FREQUENCIES : By default, missing values are excluded and percentages are based on the number
of non-missing values. If you use the missing=listwise subcommand on the frequencies command, the
percentages are based on the total number of non-missing and user-missing values and the
percentage of user-missing values are reported in the table.
CORRELATIONS : By default, correlations are computed based on the number of pairs with
non-missing data (pairwise deletion of missing data). The missing=listwise subcommand can be used
on the corr command to request that correlations be computed only on observations with complete
valid data for all variables on the var subcommand (listwise deletion of missing data).
REGRESSION : If values of any of the variables on the var subcommand are missing, the entire case
is excluded from the analysis (i.e., listwise deletion of missing data). It is possible to further control the
treatment of missing data with the missing subcommand and one of the following keywords : pairwise,
meansubstitution, or include.
ANOVA : Cases with any missing value are excluded from any single complete ANOVA design in which
the missing value is encountered. It is possible to specify more than one ANOVA design with a single
anova command.
For other commands, see the SPSS manual for information on how missing data are handled.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

21 / 43

Topics in Data Management

subsetting data

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

22 / 43

Topics in Data Management

subsetting data

Creating and using filters

You can create variables to use as filter variables and keep them in your data set.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

23 / 43

Topics in Data Management

subsetting data

Creating and using filters

You can create variables to use as filter variables and keep them in your data set.
It is important to note that SPSS does not treat system-missing and user-defined missing values the
same way.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

23 / 43

Topics in Data Management

subsetting data

Creating and using filters

You can create variables to use as filter variables and keep them in your data set.
It is important to note that SPSS does not treat system-missing and user-defined missing values the
same way.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

23 / 43

Topics in Data Management

subsetting data

Creating and using filters

You can create variables to use as filter variables and keep them in your data set.
It is important to note that SPSS does not treat system-missing and user-defined missing values the
same way.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

23 / 43

Topics in Data Management

subsetting data

Creating and using filters

You can create variables to use as filter variables and keep them in your data set.
It is important to note that SPSS does not treat system-missing and user-defined missing values the
same way.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

23 / 43

Topics in Data Management

Collapsing across observations

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

24 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

25 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

25 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

26 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

26 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

27 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

27 / 43

Topics in Data Management

Collapsing across observations

Collapsing across observations : Aggregate


There are a number of functions that can be used with the aggregate command,
including :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

28 / 43

Topics in Data Management

Concatenating data files

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

29 / 43

Topics in Data Management

Concatenating data files

Examples

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

30 / 43

Topics in Data Management

Concatenating data files

Examples

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

30 / 43

Topics in Data Management

Concatenating data files

Examples

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

30 / 43

Topics in Data Management

Concatenating data files

Examples

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

31 / 43

Topics in Data Management

Concatenating data files

Examples

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

31 / 43

Topics in Data Management

Match merging data files

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

32 / 43

Topics in Data Management

Match merging data files

One-to-one merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

33 / 43

Topics in Data Management

Match merging data files

One-to-one merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

33 / 43

Topics in Data Management

Match merging data files

One-to-one merge

Use SORT CASES to sort dads on famid and save that file(we will call it dads2.sav)

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

33 / 43

Topics in Data Management

Match merging data files

One-to-one merge

1
2

Use SORT CASES to sort dads on famid and save that file(we will call it dads2.sav)
Use SORT CASES to sort faminc on famid and save that file(we will call it faminc2.sav)

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

33 / 43

Topics in Data Management

Match merging data files

One-to-one merge

1
2
3

Use SORT CASES to sort dads on famid and save that file(we will call it dads2.sav)
Use SORT CASES to sort faminc on famid and save that file(we will call it faminc2.sav)
Use MATCH FILES to merge the dads2.sav and faminc2.sav files based on famid

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

33 / 43

Topics in Data Management

Match merging data files

One-to-one merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

34 / 43

Topics in Data Management

Match merging data files

One-to-one merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

34 / 43

Topics in Data Management

Match merging data files

One-to-many merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

35 / 43

Topics in Data Management

Match merging data files

One-to-many merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

35 / 43

Topics in Data Management

Match merging data files

One-to-many merge

Use SORT CASES BY to sort dads on famid and save that file (we will call it dads2)

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

35 / 43

Topics in Data Management

Match merging data files

One-to-many merge

1
2

Use SORT CASES BY to sort dads on famid and save that file (we will call it dads2)
Use SORT CASES BY to sort kids on famid and save that file (we will call it kids2)

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

35 / 43

Topics in Data Management

Match merging data files

One-to-many merge

1
2
3

Use SORT CASES BY to sort dads on famid and save that file (we will call it dads2)
Use SORT CASES BY to sort kids on famid and save that file (we will call it kids2)
Use MATCH FILES to merge the dads2 and kids2 files. However, since the dads file is the
file with one observation, use /TABLE="dads2.sav", not /FILE="dads2.sav" to specify the
dads file.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

35 / 43

Topics in Data Management

Match merging data files

One-to-many merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

36 / 43

Topics in Data Management

Match merging data files

One-to-many merge

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

36 / 43

Data Distributions and Random Numbers

Random Numbers

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

37 / 43

Data Distributions and Random Numbers

Random Numbers

SPSS Random Number : Generator dialog

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

38 / 43

Data Distributions and Random Numbers

Random Numbers

SPSS Random Number : Generator dialog

SPSS syntax
SET SEED=2000000
ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

38 / 43

Data Distributions and Random Numbers

SPSS syntax

Outline

Introduction

Topics in Data Management


Importing data
Creating numeric variables
Creating string variables
Recoding variables and Counting
Dates
Missing data
subsetting data
Collapsing across observations
Concatenating data files
Match merging data files

Data Distributions and Random Numbers


Random Numbers
SPSS syntax

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

39 / 43

Data Distributions and Random Numbers

SPSS syntax

Individual random variables

Example
Create 1000 cases
Return normally distributed values with a mean of 100 and a standard deviation of 20.
Return Poisson distributed values with a mean of 10.

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

40 / 43

Data Distributions and Random Numbers

SPSS syntax

Individual random variables

Example
Create 1000 cases
Return normally distributed values with a mean of 100 and a standard deviation of 20.
Return Poisson distributed values with a mean of 10.

SPSS syntax to create individual random variables with given distributions :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

40 / 43

Data Distributions and Random Numbers

SPSS syntax

Individual random variables

Example
Create 1000 cases
Return normally distributed values with a mean of 100 and a standard deviation of 20.
Return Poisson distributed values with a mean of 10.

SPSS syntax to create individual random variables with given distributions :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

40 / 43

Data Distributions and Random Numbers

SPSS syntax

Individual random variables

Example
Create 1000 cases
Return normally distributed values with a mean of 100 and a standard deviation of 20.
Return Poisson distributed values with a mean of 10.

SPSS syntax to create individual random variables with given distributions :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

40 / 43

Data Distributions and Random Numbers

SPSS syntax

Histograms

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

41 / 43

Data Distributions and Random Numbers

SPSS syntax

Histograms

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

41 / 43

Data Distributions and Random Numbers

SPSS syntax

Multiple random numbers

SPSS syntax to create multiple random numbers in a given distribution :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

42 / 43

Data Distributions and Random Numbers

SPSS syntax

Multiple random numbers

SPSS syntax to create multiple random numbers in a given distribution :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

42 / 43

Data Distributions and Random Numbers

SPSS syntax

Multiple random numbers

SPSS syntax to create multiple random numbers in a given distribution :

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

42 / 43

Data Distributions and Random Numbers

SPSS syntax

suivre...

ALJ (ULB)

Introduction to SPSS: Step II

UALS 2009

43 / 43

You might also like