Arrays & Flag Arrays

FastStats supports two kinds of array variable : Arrays and Flag Arrays.

Arrays

Arrays are used to store lists of similar data.

 

Example

Consider a source table with the following data :

Person URN

Car Make 1

Car Make 2

Car Make 3

1

Ford

- -

2

Jaguar

- -

3

Honda

BMW

Vauxhall

4

Ford

Honda

-

5

Vauxhall

Ford

-

By grouping the variables (Car Make 1, Car Make 2 and Car Make 3) into a single variable called 'Car Makes' then the user will be presented with a single variable and can use selection criteria to decide if the Person should be included in a selection or not.

Person URN

Car Makes

1

Ford

2

Jaguar

3

Honda, BMW, Vauxhall

4

Ford, Honda

5

Vauxhall, Ford

Array variables can have up to 100 different 'columns' (in this case car makes) but up to 65,534 different codes (Ford, Jaguar, Honda, etc.).

Group As Array

Multiple variables can be grouped together in a Array. For example a household may have several cars recorded as CarMake1, CarMake2, CarMake3 in your database. In this case the 3 consecutive variables can be grouped as a AllCarMakes array. The end user would select from AllCarMakes as a single variable in which FastStats searches for the selected items.

A FastStats array has the following properties:

  • Each element variable must be type Selector and have identical size and mapping (if any)
  • The elements of the array share common Decodes
  • Maximum number of elements is 100

To create an Array variable:

  1. Sort the variables by Data Source (offset).
  2. Click to (multiple select) highlight the elemental variables e.g. CarMake1 ... CarMake2
  3. Right click and choose Group – As Array
  4. Complete a name, description and reference for the new composite FastStats variable

Flag Arrays

Flag Arrays store options that can be selected. Common uses are for large amounts of opt-in survey information.

 

Example

Consider a table with the following data :

Person URN

Ford

Jaguar

Honda

BMW

Vauxhall

1

Yes

 

 

 

 

2

 

Yes

 

 

 

3

 

 

Yes

Yes

Yes

4

Yes

 

Yes

 

 

5

Yes

 

 

 

Yes

Flag Array variables can have up to 1600 different 'columns' (Ford, Jaguar, Honda, etc.) but each column can only contain True or False.

 

Group As Flag Array

Multiple variables can be grouped together in a Flag Array. For example there are several Y/N indicators for Newspaper readership in the example data source. The end user would prefer to view these indicators as a single logical "multi-response" variable.

FastStats can represent these flags in a single variable called a flag array (bit array). The maximum number of elements is 1600.

To create a Flag Array variable:

  1. Sort the variables by Data Source (offset).
  2. Click to highlight (multiple select) the elemental variables e.g. Sun, Guardian ... FT
  3. Right click and choose Group – As Flag Array
  4. Complete a name and description for the new composite FastStats variable.

By default the positive ("Yes") indicators are specified as Y, y, X, y, 1, T or t. If any of the positive indicators are found in the field it will be recorded as a "Yes".

FastStats also supports flag arrays defined from a single variable in which case the field must contain a fully populated string of Y/N or 1/0 indicators. To define a flag array from a single field just highlight the one field, right click and Group – As Flag Array.

Array to Bits

The Check Box 'Array to Bits' creates a Flag Array variable from data in an Array format. So it takes the above top input data for an Array and produces the Flag Array variable seen just above. You would use this if for example a Person could own more than 100 cars !

Single Field Arrays

Arrays can be defined from a single field (instead of grouping multiple fields together). This can either be done by specifying a fixed width list of codes within a delimited data field, or if using the Enhanced build process you can specify a second delimiter to separate the coded values within the field.

Fixed Width Single Field Arrays

Person URN

Cars

1

Ford

2

Jaguar

3

Honda VauxhallBMW

4

Ford Honda

5

VauxhallFord

In this case the data width is 8 (all codes are 8 characters wide). To tell FastStats Designer to split up the values set the Code Size to the total width of the incoming data and set the Map Size to the width of each code (8).

This will divide up the incoming data into 8 character wide codes:

Delimited Single Field Arrays

If the Enhanced Data Build process is enabled then you can specify a second delimiter to split the coded values within a field:

Person URN

Cars

1

Ford

2

Jaguar

3

Honda;Vauxhall;BMW

4

Ford;Honda

5

Vauxhall;Ford

Set the Define Variable properties of the Array variable like this:

The Code Size and the Number of Array Elements can be set to 0 and they will be auto-detected during the build. If set to 0 then they will at 0 so that the sizes are auto-detected for future builds.