- REWEIGHT < condition | ALLOBS >
< / options > ;
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.
- REWEIGHT < STATUS |
UNDO > ;
The model and corresponding statistics are
not recomputed after a REWEIGHT statement.
For example, with the following statements
the second REWEIGHT statement does not exclude any
additional observations since the model is not
recomputed after the first REWEIGHT statement.
Use either 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
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
variable compare value logical
variable compare value
- 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
can be used instead of the preceding symbols.
Refer to the "Expressions" chapter in SAS
Language Reference: Concepts for more information on 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:
- 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 |.
Examples of the variable compare value form are
reweight obs. le 10;
Examples of the variable compare value
logical variable compare value form are
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.
reweight allobs / reset;
resets weights for all observations and uses
all observations in the subsequent analysis.
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
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, with the statements
reweight r.>0 / weight=0.1;
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.
suppresses the display of the selected observation numbers.
If you omit the NOLIST option, a list
of observations selected is written to the log.
resets the observation weights to their original
values as defined by the WEIGHT statement or to
WEIGHT=1 if no WEIGHT statement is specified.
reweight / reset;
resets observation weights to the
original weights in the data set.
If previous REWEIGHT statements have been submitted,
this REWEIGHT statement applies only to the
observations selected by the previous REWEIGHT statement.
Note that, although the RESET option does reset observation
weights to their original values, it does not cause the
model and corresponding statistics to be recomputed.
changes observation weights to the
specified nonnegative real number.
If you omit the WEIGHT= option,
the observation weights are set to zero, and
observations are excluded from the analysis.
...other interactive statements
reweight / weight=0.5;
The first REWEIGHT statement changes weights
to zero for all observations with name='Alan',
effectively deleting these observations.
The subsequent analysis does not include these observations.
second REWEIGHT statement applies only to those observations
selected by the previous REWEIGHT statement, and it changes the
weights to 0.5 for all the observations with NAME='Alan'.
Thus, the next analysis includes all original
observations; however, those observations with
NAME='Alan' have their weights set to 0.5.
STATUS and UNDO
If you omit condition and the ALLOBS options,
you can specify one of the following options.
writes to the log the observation's number
and the weight of all reweighted observations.
If an observation's weight has been
set to zero, it is reported as deleted.
However, the observation is not deleted
from the data set, only from the analysis.
undoes the changes made
by the most recent REWEIGHT statement.
Weights may be, but are not necessarily, reset.
For example, in these statements
reweight student.>2 / weight=0.1;
the first REWEIGHT statement sets the weights
of observations that satisfy the condition to 0.1.
The second REWEIGHT statement sets the
weights of the same observations to zero.
The third REWEIGHT statement undoes the
second, changing the weights back to 0.1.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.