Overview (WEIGHT command)
WEIGHT gives
cases different weights (by simulated replication) for statistical
analysis. WEIGHT can be used
to weight a sample up to population size for reporting purposes or
to replicate an example from a table or other aggregated data. With WEIGHT, you can arithmetically alter the
sample size or its distribution.
To apply weights resulting from your sampling design, see Sampling and Testing.
Basic Specification
The basic
specification is keyword BY followed
by the name of the weight variable. Cases are weighted according to
the values of the specified variable.
Syntax Rules
- Only one numeric variable can be specified. The variable can be a precoded weighting variable, or it can be computed with the transformation language.
-
WEIGHTcannot be placed within aFILE TYPE—END FILE TYPEorINPUT PROGRAM—END INPUT PROGRAMstructure. It can be placed nearly anywhere following these commands in a transformation program. See the topic Commands and Program States for more information.
Operations
- Unlike most
transformations,
WEIGHTtakes effect as soon as it is encountered in the command sequence. Thus, special attention should be paid to its position among commands. See the topic Command Order for more information. - Weighting is permanent during a session unless it is preceded by
a
TEMPORARYcommand, changed by anotherWEIGHTcommand, or turned off with theWEIGHT OFFspecification. - Each
WEIGHTcommand overrides the previous one. -
WEIGHTuses the value of the specified variable to arithmetically replicate cases for subsequent procedures. Cases are not physically replicated. - Weight values do not need to be integer, and some procedures, such as
FREQUENCIES,CROSSTABS, andCTABLES, will use fractional values on theWEIGHTvariable. However, most procedures treat theWEIGHTvariable as a replication weight and will simply round fractional weights to the nearest integer. Some procedures ignore theWEIGHTvariable completely, and this limitation is noted in the procedure-specific documentation. Procedures in the Complex Samples add-on module can use inverse sampling weights specified on theCSPLANcommand. - Cases with missing or nonpositive values for the weighting variable are treated as having a weight of 0 and are thus invisible to statistical procedures. They are not used in calculations even where unweighted counts are specified. These cases do remain in the file, however, and are included in case listings and saved when the file is saved.
- A file saved when weighting is in effect maintains the weighting.
- If the weighted number of cases exceeds the sample size, tests of significance are inflated; if it is smaller, they are deflated.