DATA Step, Macro, Functions and more

SYSERR macro variable

Reply
Contributor
Posts: 43

SYSERR macro variable

Dear all,

When I execute the code below, I am having the following warning message:

WARNING: The relative Hessian convergence criterion of 0.2919725428 is greater than the limit
of 0.0001. The convergence is questionable.
WARNING: The procedure is continuing but the validity of the model fit is questionable.


However, if I show the content of the variable SYSERR, it is equal to 0 instead of 4, as indicated in sas documentation:

SYSERR can contain the following values:

Value Description
0 Execution completed successfully and without warning messages.
1 Execution was canceled by a user with a RUN CANCEL statement.
2 Execution was canceled by a user with an ATTN or BREAK command.
3 An error in a program run in batch or non-interactive mode caused SAS to enter syntax-check mode.
4 Execution completed successfully but with warning messages.
[...]

************************************************

data sim_data;
call streaminit(17427);
do k = 1 to 200;
x = 'pl';
y = rand('NEGBINOMIAL', 0.80, 1);
output;
end;
do k = 1 to 200;
x = 'tx';
y = rand('NEGBINOMIAL', 0.85, 1);
output;
end;
run;

proc genmod data=sim_data;
class x (param=ref ref='pl');
model y = x / dist=NEGBIN ;
lsmeans x;
run;

%put &syserr;

Any idea??
Respected Advisor
Posts: 3,777

Re: SYSERR macro variable

Perhaps you could use SYSWARNINGTEXT automatic variable.

[pre]
AUTOMATIC SYSWARNINGTEXT The procedure is continuing but the validity of the model fit is questionable
[/pre]
Contributor
Posts: 43

Re: SYSERR macro variable

Thanks for your help!

the problem is that SYSWARNINGTEXT is only updated with a new warning message. If you run a process that works, in this variables is still stored the previous warning message so I can not distinguish between the proces that works and the one that doesn't work.

Try this just after my syntax above:

data _null_;
set _null_;
run;

%put &syserr &SYSWARNINGTEXT ;
Respected Advisor
Posts: 3,777

Re: SYSERR macro variable

The concergence status output has the relevant information.

[pre]
Output Added:
-------------
Name: ConvergenceStatus
Label: Convergence Status
Template: Stat.Genmod.ConvergenceStatus
Path: Genmod.ConvergenceStatus
-------------
[/pre]
Contributor
Posts: 43

Re: SYSERR macro variable

Thanks!

yes, at the moment I will try that. However, I would like to control over other possible warnings. I am doing a macro to calculate required sample size based on GLMz models. For that I am doing simulations where if one of them doesn't work I have to repead. In general terms, I think (because I still don't know) that in 10,000 iteration I can find more problems than the convergence one, so I would like to have a general way to repeat any iteration with a warning message.

Thanks for your help!!
Juanvte.
SAS Employee
Posts: 58

Re: SYSERR macro variable

This works correctly at SAS 9.3 (which is about to be released -- keep sitting there).

As for the problem at 9.2 - this appears to be an issue with Proc Genmod. The SAS Macro Facility merely fetches the value for &syserr from the rest of the SAS System, where it's supposed to be set correctly by the data steps / procs.
Ask a Question
Discussion stats
  • 5 replies
  • 1043 views
  • 0 likes
  • 3 in conversation