The time and memory requirements in PROC LOGISTIC are largely a function of the number of parameters in each model and the number of models being fit. Large amounts of time and/or memory can be required by PROC LOGISTIC if there are many model parameters when model selection is not used, or if there are too many candidate models (perhaps also with too many parameters in the larger candidates) when model selection is used. Model selection methods are invoked by the SELECTION= option in the MODEL statement. Remember that PROC LOGISTIC uses an iterative, maximum likelihood algorithm to fit each model, and the number of iterations needed cannot be known in advance. See Computational Resources in the Details section of the PROC LOGISTIC documentation for details about time and memory requirements.
Beginning in SAS® 9.4, the HPLOGISTIC and HPGENSELECT procedures can also be used to fit logistic models. Logistic models can also be fit in the LOGSELECT and GENSELECT procedures in SAS® Viya®. These procedures are multithreaded, which can allow for faster performance as the number of observations becomes large, particularly when run in a distributed mode on an appliance that consists of a cluster of nodes. Faster performance might also be obtained on a single machine with several processors. For more information, see "Shared Concepts and Topics" and the HPLOGISTIC or HPGENSELECT chapters in SAS/STAT User's Guide: High-Performance Procedures.
Discussed below are some common causes of excessive time and/or memory use and possible remedies.
proc freq data=mydata nlevels;
table y / noprint;
run;
The response variable should never be continuous. Attempting to model a continuous response can easily require excessive time and memory because it adds many intercept parameters to the model. Other modeling procedures (REG, GLM, GLIMMIX, GENMOD, etc.) should be considered if the response is continuous.
For example, even if there is only one variable in the model, the number of parameters is large if the number of levels of the variable is large and the variable is a CLASS variable. To check the number of levels in the CLASS variables, run these PROC FREQ statements that list all of the CLASS variables in the TABLE statement:
proc freq data=mydata nlevels;
table list-all-CLASS-variables / noprint;
run;
The following model involves only 10 variables, but the use of the vertical bars includes all possible interactions up to and including the 10-way interaction, resulting in a model with over 1,000 parameters. The same MODEL statement could result in an even larger number of parameters if some of the variables were CLASS variables with multiple levels:
proc logistic;
model y = a|b|c|d|e|f|g|h|i|j;
run;
A model that includes only main effects and two-way interactions is much smaller and frequently all that is needed. Use the @2 modifier to request this model:
proc logistic;
model y = a|b|c|d|e|f|g|h|i|j@2;
run;
When there are many candidate variables or effects, consider using the SELECTION= option to screen variables and to build a model. See comments on the use of SELECTION= later in this note:
Exact logistic regression is extremely memory- and computation-intensive method and can take a great deal of time and memory. It is not possible to know in advance how much time or memory a given problem will take. Specify the EXACTOPTIONS STATUSTIME=x; statement in order to have a status line printed to the SAS log every x seconds. See Computational Resources for Exact Logistic Regression in the Details section of the PROC LOGISTIC documentation for additional discussion of time and memory requirements and suggestions for minimizing them.