Most modeling procedures which use an iterative fitting algorithm (such as maximum likelihood or generalized estimating equations) produce, by default, a table indicating the convergence status of the model. The name of this table, for use in ODS statements, is ConvergenceStatus. GENMOD, GLIMMIX, LOGISTIC, MIXED, and GAM are just a few of the procedures that create a ConvergenceStatus table. You can see if a procedure produces a ConvergenceStatus table by checking "ODS Table Names" in the Details section of the procedure's documentation. When saved as a SAS® data set using an ODS OUTPUT statement, the ConvergenceStatus table contains a numeric variable, Status, which takes the value zero when proper convergence is achieved. When convergence fails or is questionable, the Status value is nonzeroNOTE1 and the Reason variable explains the nature of the problem.
In some procedures which can fit multiple models, such as the LOGISTIC and PHREG procedures when using effect selection via the SELECTION= option, the ConvergenceStatus table will contain an observation with status information for each model fit by the procedure.
The following example fits a Poisson model in PROC GENMOD and checks for convergence of the model before proceeding to score a new data set. In the GENMOD step, the STORE statement saves the fitted model. The ODS OUTPUT statement saves the convergence status to data set CS. The SQL step reads the value of the Status variable in data set CS and stores it in a macro variable named ConvstatNOTE2. The %PUT statement displays the value of the Convstat macro variable in the Log. The SCORE macro is defined next. The macro definition (between the %MACRO and %MEND statements) runs the PLM procedure to score data set NEWDATA only if the convergence status is equal to 0, indicating convergence of the Poisson model. Finally, the SCORE macro is invoked.
proc genmod data=insure; class car age; model c = car age / dist=poisson offset=ln; store out=pmod; ods output ConvergenceStatus=cs; run; proc sql noprint; select status into :Convstat from cs; quit; %put &Convstat; %macro score; %if &Convstat = 0 %then %do; proc plm restore=pmod; score data=newdata out=newscores; run; %end; %mend; %score
Procedures that do not use an iterative fitting algorithm, such as the REG and GLM procedures which fit models using ordinary least squares, do not produce a table indicating status of the fit. Many procedures set the SYSERR macro variable to a nonzero value if the procedure encounters certain error conditions such as insufficient memory. However, for a given procedure, there may be error conditions that do not result in a nonzero value of SYSERR. For instance, in an interactive procedure such as REG or GLM, if a specified variable is not found, the statement is ignored and SYSERR is not set to a nonzero value. For more details, see the description of the SYSERR automatic macro variable in the SAS Macro Language: Reference.
These statements check for normal completion of PROC GLM before proceeding to score a new data set. If the large number of model parameters, 2001, in the model were to cause an out of memory condition, the scoring macro would not run the PLM procedure. The SCORE macro is called immediately after the GLM step to avoid the possibility of the SYSERR macro variable being changed by any intervening code.
%macro score; %if &syserr = 0 %then %do; proc plm restore=gmod; score data=newdata out=newscores; run; %end; %mend; proc glm data=mydata; model y=x1-x2000; store out=gmod; run; quit; %score
__________
NOTE 1: In PROC MIXED, the Status variable can have value 0 even if the Hessian matrix is not positive definite. The variables PDG and PDH in the ConvergenceStatus table indicate whether the G and H matrices are positive definite. To check that proper convergence was achieved, verify that PDG=1 and PDH=1 in addition to checking that Status=0.
NOTE 2: The Convstat macro variable can also be created using a DATA step, rather than an SQL step. The keyword _NULL_ prevents the DATA step from creating a new data set.
data _null_; set cs; call symput("Convstat",Status); run;
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
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 | ||||
SAS System | SAS/ETS | z/OS | ||
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 |
Type: | Usage Note |
Priority: | |
Topic: | Analytics ==> Analysis of Variance Analytics ==> Categorical Data Analysis Analytics ==> Econometrics Analytics ==> Longitudinal Analysis Analytics ==> Mixed Models Analytics ==> Regression |
Date Modified: | 2013-10-25 10:37:27 |
Date Created: | 2013-10-24 14:47:07 |