Extract a subset of data

 

Menu location: Data_Grouping_Extract.

 

This function enables you to extract subsets of data from a column of numbers, based upon an expression that refers to indicators in related rows of worksheet.

 

For example, you might want to select only the rows from a score data column for which sex=2 and age>30; i.e. extract into one new variable, all data for females over 30:

 

Sex

Age

Score

1

23

2.3

1

33

3.1

1

19

3.2

2

21

1.9

2

43

4.2

2

39

5.0

2

26

1.1

 

Use the Data_Grouping_Extract menu item with Score as the data variable and Sex and Age and the indicator variables to create a new variable with the expression "v1=1 and v2>30":

 

Score [Sex=2 AND Age>30]

4.2

5

 

You can compose an expression using v1, v2 etc. and any of the functions, operators and logical expressions described under search and replace. Here are some examples of expressions for the example of the two indicators mentioned above:

 

V1: Sex

V2 Age

 

"v1=1" (not all of the selected/listed indicator variables have to be used)

"v2<>21 and v2>16"

"v1=2 or v2>25"

"(v1=1 and v2<=25) or (v1=2 and v2<=30)"