Hello SAS users,
I am running some simulations using PROC LIFEREG with a bayes statement in place. There are instances where the simulations fail to converge, and the proc statement aborts with a floating point error. I am wondering if there is a way to implement a try-catch error - to catch the simulations that fail to converge but move onto the next one instead of aborting the proc.
note: NOTE: The above message was for the following BY group: note: SimulID=15 note: NOTE: Algorithm converged. error: ERROR: Floating Point Zero Divide. error: ERROR: Termination due to Floating Point Exception note: NOTE: The SAS System stopped processing this step because of errors. note: NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode. note: This prevents execution of subsequent data modification statements. warning: WARNING: The data set WORK.POSTERIORSAMPLE11 may be incomplete. When this step was stopped there were 37500 observations and 9 title: 58 The SAS System Thursday, December 30, 2021 03:08:29 AM title: warning: variables.
My institute has a license for only SAS 9.4, and I am using SAS Viya for Learners.
Thank you.
Please post your PROC LIFEREG code statements.
Yes, this is what it looks like:
ods output PosteriorSample=PosteriorSample; proc lifereg data = IGamma; class arm ; model Y*L_evt(0)= arm/dist = Gamma; bayes seed=1729 nmc = 2500 thinning=1 coeffprior=normal(var=1E6) scaleprior=gamma(shape=0.001, iscale=0.001) gammashapeprior=normal(mean=0, var=100) nbi = 2000; run;
Hello,
Your original post LIFEREG code had by-groups :
note: NOTE: The above message was for the following BY group: note: SimulID=15
I do not see them (the by-groups) in the above code.
Instead of working with by-groups, you can also build loops over PROC LIFREG. But that is less performant and may lead to some extra coding to collapse the results.
Thanks,
Koen
You are right. Thank you.
This is the code that I used to produce that error.
ods output PosteriorSample=PosteriorSample11; proc lifereg data = IGamma1 noprint; by SimulID; class arm ; model Y1*L_evt1(0)= arm/dist = Gamma; bayes seed=&seed nmc = &mcmc thinning=&thinning coeffprior=normal(var=1E6) scaleprior=gamma(shape=&gamma_shape, iscale=&gamma_iscale) gammashapeprior=normal(mean=&gamma_mean, var=&gamma_var) nbi = &burn; run;
It might help to show the current values of all the macro variables. Without the values of the macro variables the code isn't clear.
Or possibly run the code with Options MPRINT set to show the generate code in the log and post the log.
Yes, these are the current values for the macro variables.
ods output PosteriorSample=PosteriorSample11; proc lifereg data = IGamma1 noprint; by SimulID; class arm ; model Y1*L_evt1(0)= arm/dist = Gamma; bayes seed=1729 nmc=2500 thinning=1 coeffprior=normal(var=1E6) scaleprior=gamma(shape=86.9, iscale=65.4) gammashapeprior=normal(mean=0.49675, var=0.12051) nbi = 3000; run;
This is almost surely a data-dependent problem since it only happens when SimulID=15. We can try to diagnose it here, but I think floating-point errors should be reported to SAS Technical Support so that the developer can address the issue.
From the name of your BY-group variable, I assume that you are running a simulation? If so, please provide the code that simulates the data or (if the sample size is small) provide the simulated data for SimulID=15.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →