Programming the statistical procedures from SAS

Proc model error dealing

Reply
Occasional Contributor
Posts: 5

Proc model error dealing

Hi,

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);
26            output;
27            end;
28       run;

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


29
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;
36       run;

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.
37
38       %put &syserr &syserrtext;
WARNING: Apparent symbolic reference SYSERRTEXT not resolved.
0 &syserrtext

Thank you very much

Federica

Respected Advisor
Posts: 4,756

Re: Proc model error dealing

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.

PG

PG
N/A
Posts: 1

Re: Proc model error dealing

Hi Federica,

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";

      fit y;

quit; /* This is the missing statement */

%put SYSINFO=&sysinfo;

Now it works!

Ask a Question
Discussion stats
  • 2 replies
  • 299 views
  • 0 likes
  • 3 in conversation