REWEIGHT <condition ALLOBS> </ options>;
REWEIGHT <STATUS UNDO>;
The REWEIGHT statement interactively changes the weights of observations that are used in computing the regression equation. The REWEIGHT statement can change observation weights, or set them to zero, which causes selected observations to be excluded from the analysis. When a REWEIGHT statement sets observation weights to zero, the observations are not deleted from the data set. More than one REWEIGHT statement can be used. The requests from all REWEIGHT statements are applied to the subsequent statements. Each use of the REWEIGHT statement modifies the MODEL label.
The model and corresponding statistics are not recomputed after a REWEIGHT statement. For example, consider the following statements:
reweight r.>0; reweight r.>0;
The second REWEIGHT statement does not exclude any additional observations since the model is not recomputed after the first REWEIGHT statement. Either use a REFIT statement to explicitly refit the model, or implicitly refit the model by following the REWEIGHT statement with any other interactive statement except a PAINT statement or another REWEIGHT statement.
The REWEIGHT statement cannot be used if a TYPE=CORR, TYPE=COV, or TYPE=SSCP data set is used as an input data set to PROC REG. Note that the syntax used in the REWEIGHT statement is the same as the syntax in the PAINT statement.
The syntax of the REWEIGHT statement is described in the following sections.
For detailed examples of using this statement, see the section Reweighting Observations in an Analysis.
Condition is used to find observations to be reweighted. The syntax of condition is
variable compare value
or
variable compare value logical variable compare value
where
is one of the following:
a variable name in the input data set
OBS., which is the observation number
keyword., where keyword is a keyword for a statistic requested in the OUTPUT statement. The keyword specification is applied to all dependent variables in the model.
is an operator that compares variable to value. Compare can be any one of the following: <, <=, >, >=, =, ^=. The operators LT, LE, GT, GE, EQ, and NE, respectively, can be used instead of the preceding symbols. See the "Expressions" chapter in SAS Language Reference: Concepts for more information about comparison operators.
gives an unformatted value of variable. Observations are selected to be reweighted if they satisfy the condition created by variable compare value. Value can be a number or a character string. If value is a character string, it must be eight characters or less and must be enclosed in quotes. In addition, value is case-sensitive. In other words, the following two statements are not the same:
reweight name='steve';
reweight name='Steve';
is one of two logical operators. Either AND or OR can be used. To specify AND, use AND or the symbol &. To specify OR, use OR or the symbol |.
Here are some examples of the variable compare value form:
reweight obs. le 10; reweight temp=55; reweight type='new';
Here are some examples of the variable compare value logical variable compare value form:
reweight obs.<=10 and residual.<2; reweight student.<-2 or student.>2; reweight name='Mary' | name='Susan';
Instead of specifying condition, you can use the ALLOBS option to select all observations. This is most useful when you want to restore the original weights of all observations. For example,
reweight allobs / reset;
resets weights for all observations and uses all observations in the subsequent analysis. Note that
reweight allobs;
specifies that all observations be excluded from analysis. Consequently, using ALLOBS is useful only if you also use one of the options discussed in the following section.
The following options can be used when either a condition, ALLOBS, or nothing is specified before the slash. If only an option is listed, the option applies to the observations selected in the previous REWEIGHT statement, not to the observations selected by reapplying the condition from the previous REWEIGHT statement. For example, consider the following statements:
reweight r.>0 / weight=0.1; refit; reweight;
The second REWEIGHT statement excludes from the analysis only those observations selected in the first REWEIGHT statement. No additional observations are excluded even if there are new observations that meet the condition in the first REWEIGHT statement.
Note: Options are not available when either the UNDO or STATUS option is used.
If you omit condition and the ALLOBS options, you can specify one of the following options.