Effect selection methods are available in many modeling procedures, typically by specifying a SELECTION= option or SELECTION statement. An effect is a general name that applies to a variable or to a model term such as an interaction or nested term. Effect selection methods perform automated selection from a list of candidate model effects that you specify. Methods include forward, backward, stepwise, LASSO (with adaptive and group lasso variants), and LAR. Various selection methods are available in several procedures in SAS/STAT® (such as in REG, GLMSELECT, HPGENSELECT, LOGISTIC, PHREG, and others), SAS/ETS® (COUNTREG and HPCOUNTREG), and SAS® Viya® (such as in REGSELECT, GENSELECT, LOGSELECT, PHSELECT, CNTSELECT, and others). For details, see the documentation for the modeling procedure that you use.
One common need is to restrict the effect selection method so that a group of variables enters or leaves the model together. The most common of these situations is when you have categorical variables that are to be represented in the model by sets of coded design variables, often called indicator or dummy variables. With most procedures, this is easily accommodated by specifying any categorical variables in the CLASS statement of the procedure. The use of the CLASS statement is further discussed in this article. The CLASS statement creates the design variables for you and automatically treats all design variables for an effect as a group that enters or leaves the model together.
For example, in the following statements, A and B are categorical variables and X is continuous. The CLASS statement produces a set of design variables for A and another set for B. Since at least one CLASS variable is involved, the A*B and A*X effects are also represented by sets of variables. All design variables for each of these effects enter or leave the model as a group. For example, if the effect selection method determines that A should be added to the model, all of its design variables are added. At a later step, if the method determines that effect A*B should be removed, all of its design variables are removed.
proc hpgenselect; class a b; model y = x a b a*b a*x; selection method=stepwise; run;
If you have a group of variables that are logically connected, you might want them to enter or leave the model together. For example, in a health study you might want diastolic and systolic blood pressure variables to be a group, and running and resting pulse rates to be another group. A group can consist of any combination of continuous or categorical variables.
Such arbitrary groupings of effects can be defined in procedures in which the EFFECT statement is available. See the description of the EFFECT statement in the "Shared Concepts and Topics" chapter of the SAS/STAT User's Guide. A special grouping syntax is available in PROC REG.Note Many modeling procedures (such as GLMSELECT, LOGISTIC, PHREG, and others) offer both effect selection methods and the EFFECT statement. There are additional procedures that support the EFFECT statement, but which do not provide effect selection.
You define a group using the collection effect type in the EFFECT statement. Then specify the name of the group in the MODEL statement instead of the individual variable names. For example, the EFFECT statement below defines a collection as the grouping of categorical variable A and continuous variables X1 and X2. You can use additional EFFECT statements to define more groups as needed. During the stepwise effect selection procedure, variables A, X1, and X2 will enter or leave the model together. The variables X3 and Z will be considered individually.
proc logistic; class a; effect group1=collection(a x1 x2); model y = group1 x3 z / selection=stepwise; run;
__________
Note: In PROC REG, you can create groups of variables using braces ( { } ) in the MODEL statement. For example, the following MODEL statement creates two groups. One group consists of variables X1 and X2. The other group consists of variables X3, X4, and X5. During the stepwise variable selection procedure, X1 and X2 will enter or leave the model together. Similarly, variables X3, X4, and X5 will enter or leave as a group.
model y = {x1 x2} {x3 x4 x5} / selection=stepwise;