08-31-2012 04:43 AM
I've problem in intercepting errors in proc model. Is there a macro variable that I can use to do it? I've tried with &syserr but with no siìuccess.
Here is an example:
22 data test;
23 do i = 1 to 20;
24 x = 5 * ranuni(1234);
25 y = 10 + 2 * sqrt(x) + .5 * rannor(2345);
NOTE: The data set WORK.TEST has 20 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.00 seconds
30 proc model data=test;
31 y = a + b * x ** c;
32 label a = "Intercept"
33 b = "Coefficient of Transformed X"
34 c = "Power Transformation Parameter";
35 fit y;
NOTE: The iteration limit is exceeded for OLS.
ERROR: The parameter estimates failed to converge for OLS after 100 iterations using
CONVERGE=0.001 as the convergence criteria.
38 %put &syserr &syserrtext;
WARNING: Apparent symbolic reference SYSERRTEXT not resolved.
Thank you very much
09-01-2012 08:56 PM
Found in the doc :
PROC MODEL stores a return code in the automatic macro variable SYSINFO upon
completion of the PROC MODEL step. In the event any FIT or SOLVE task fails to
converge during the completion of a PROC MODEL step the value 1 is stored in the
SYSINFO macro variable. Any subsequent SAS step will reset the value of SYSINFO.
01-30-2013 10:14 AM
The problem is that SYSINFO is set "on completion of a PROC MODEL step". That's why it's adviced to use:
proc model data=test;
y = a + b * x ** c;
label a = "Intercept"
b = "Coefficient of Transformed X"
c = "Power Transformation Parameter";
quit; /* This is the missing statement */
Now it works!