Contents: | Purpose / History / Requirements / Usage / Details / Limitations |
Standard model selection is done by choosing candidate effects for entry to or removal from the model according to their significance levels. After completion, the set of models selected at each step of this process is sorted on the selected criterion - AUC, R-square, max-rescaled R-square, AIC, or BIC. The requested number of best models on the selected criterion is displayed.
Version | Update Notes |
1.0 | Initial coding |
%inc "<location of your file containing the SELECT macro>";
Following this statement, you can call the SELECT macro. See the Results tab for examples.
The following parameters are required when using the SELECT macro:
The following parameters are optional:
The version of the SELECT macro that you are using is displayed when you specify version (or any string) as the first argument. For example:
%SELECT(version, response=y, model=x1-x10)
Note that since the SELECT macro uses PROC LOGISTIC to fit models, differences from PROC HPLOGISTIC can occur due to differences in defaults. For example, PROC HPLOGISTIC does not require model hierarchy by default and uses a Newton-Raphson algorithm rather than the Fisher scoring method. Using the HIERARCHY=NONE and TECHNIQUE=NEWTON options in the MODEL statement of PROC LOGISTIC removes these differences.
Macro updates:
The SELECT macro attempts to check for a later version of itself. If it is unable to do this (such as if there is no active Internet connection available), the macro issues the following message:
SELECT: Unable to check for newer version
The computations performed by the macro are not affected by the appearance of this message.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The following call of the SELECT macro uses the stepwise method to select a model from a set of candidate effects that includes the main effects and two-way interactions of the four predictor variables. Effects are allowed to enter and stay in the model if they are significant at the 0.25 level. The set of selected models are then ordered by their AUC values and displayed. Before calling the SELECT macro, specify a %INC statement once per SAS session to define the macro and make it available for use during that SAS session.
%inc "<location of your file containing the SELECT macro>"; %select(data=neuralgia, response=Pain(event="No"), class=Treatment(ref="P") Sex(ref="M") / param=ref, model=Treatment|Sex|Age|Duration@2, method=stepwise, sle=.25, sls=.25, choose=auc)
The table of selected models displayed by the macro shows that the model with the best AUC (0.926) contains Treatment, Sex, and Age main effects as well as the Treatment*Age interaction. This model was selected in the fourth and final step of the stepwise selection method.
|
Note that the selection of model effects occurs in the same way as by PROC LOGISTIC or PROC HPLOGISTIC, but these procedures do not allow final selection of a model based on AUC or R-square statistics. That is, the same set of four models is found as follows, but not sorted using those two statistics. Note that the TECHNIQUE=NEWTON and HIERARCHY=SINGLE options are used to make the procedures match.
proc logistic data=neuralgia; class Treatment(ref="P") Sex(ref="M") / param=ref; model Pain(event="No") = Treatment|Sex|Age|Duration@2 / selection=stepwise sle=.25 sls=.25 technique=newton; run; proc hplogistic data=neuralgia; class Treatment(ref="P") Sex(ref="M") / param=ref; model Pain(event="No") = Treatment|Sex|Age|Duration@2; selection method=stepwise(select=SL sle=.25 sls=.25) hierarchy=single; run;
After the set of models is selected, the models are ordered by their max-rescaled R-square values for display. The BEST=3 option limits the display to the three models with the largest max-rescaled R-square values. The DETAILS=SUMMARY option also requests display of the stepwise method summary table from PROC LOGISTIC.
%select(data=docvisit, response=dvisits, model=sex--chcond2, choose=rsquare_rescaled, best=3, modelopts=unequalslopes equalslopes, details=summary)
The selected model has equal slopes for four of the predictors and unequal slopes for two others. It was the last model selected and has the largest max-rescaled R-square (0.185).
The LOGISTIC Procedure
|
Right-click on the link below and select Save to save the SELECT macro definition to a file. It is recommended that you name the file select.sas.
Type: | Sample |
Topic: | Analytics ==> Categorical Data Analysis Analytics ==> Regression SAS Reference ==> Procedures ==> LOGISTIC |
Date Modified: | 2014-12-16 14:01:50 |
Date Created: | 2014-12-16 13:38:07 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/STAT | z/OS | ||
Z64 | ||||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 8 Enterprise 32-bit | ||||
Microsoft Windows 8 Enterprise x64 | ||||
Microsoft Windows 8 Pro 32-bit | ||||
Microsoft Windows 8 Pro x64 | ||||
Microsoft Windows 8.1 Enterprise 32-bit | ||||
Microsoft Windows 8.1 Enterprise x64 | ||||
Microsoft Windows 8.1 Pro | ||||
Microsoft Windows 8.1 Pro 32-bit | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2003 for x64 | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows Server 2008 R2 | ||||
Microsoft Windows Server 2008 for x64 | ||||
Microsoft Windows Server 2012 Datacenter | ||||
Microsoft Windows Server 2012 R2 Datacenter | ||||
Microsoft Windows Server 2012 R2 Std | ||||
Microsoft Windows Server 2012 Std | ||||
Microsoft Windows XP Professional | ||||
Windows 7 Enterprise 32 bit | ||||
Windows 7 Enterprise x64 | ||||
Windows 7 Home Premium 32 bit | ||||
Windows 7 Home Premium x64 | ||||
Windows 7 Professional 32 bit | ||||
Windows 7 Professional x64 | ||||
Windows 7 Ultimate 32 bit | ||||
Windows 7 Ultimate x64 | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
Windows Vista for x64 | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |