Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Statscraft 0.61.0, release v0.61.0

WEIGHT

Weight the cases by a variable, or turn weighting off.

Syntax

WEIGHT BY var.
WEIGHT OFF.

The command makes each case count as many times as its value of var, a numeric variable: a case with weight 2.5 counts as two and a half cases. Weighting stays on until WEIGHT OFF, until the variable is deleted, or until another data file is read, and SAVE stores it with the data. Fractional weights are used as they are in counts, percentages and statistics; most significance tests, confidence intervals and standard errors round them. A case whose weight is zero, negative or missing is left out. SHOW WEIGHT tells which variable weights the data.

Example

GET FILE='survey.sav'.
WEIGHT BY weight.
FREQUENCIES age_group.
WEIGHT OFF.
FREQUENCIES age_group.

The example reads the sample data file survey.sav, an invented customer survey; save it in the folder you run the syntax from.

Example output

Age group

CategoryValueLabelFrequencyPercentValid PercentCumulative Percent
valid118-2950.6815.9715.9715.97
valid230-44106.5133.5533.5549.52
valid345-59117.8237.1237.1286.64
valid460 and over42.4113.3613.36100
total317.42100

statscraft help WEIGHT prints the same text in the terminal. All commands