Hello all,
I want to use IPW weights in my survival analysis to get the Kaplan-Meier curve (add the weight statement) but when I run the procedure I get
ERRROR: Domain error
ERROR: Floating point exception
Is there anyone that can fix it? I need it for my thesis!!
Thanks,
Margherita
First, check the quality of your data. Are the weights all positive? To get basic statistics for the weights, run
proc means data=MyData;
var MyWeightVar;
run;
If your weights are valid, then post some sample data and the SAS code that you are using so that we can see what you are doing.
I have two sets of weights, normal weights and stabilized weights, here is all the information about my data:
NORMAL WEIGHTS
Variabile di analisi: iptw
N Average Std dev Min Max
1400 | 1.8026681 | 0.9106701 | 1.0157942 | 6.1039446 |
STABILIZED WEIGHTS
Variabile di analisi: iptws
N Average Std dev Min Max
1400 | 0.9536681 | 0.3630199 | 0.4093205 | 2.5291374 |
As you can see they are all positive and not so small, so I don't know where the problem is 😞
Here is my dataset ordered by iptws (stabilized weights)
count trt sex age V1 V2 V3 V4 V5 event_time status _LEVEL_ logit_ps ps iptw iptws
390 | Treatment | M | 74 | 7.25 | 25.9 | 3 | 20 | 2880 | 2 | 1 | Treatment | 0.83789 | 0.69802 | 1.43262 | 0.40932 |
344 | Treatment | M | 60 | 7.35 | 28.41 | 2 | 20 | 2958 | 3 | 1 | Treatment | 0.83777 | 0.69799 | 1.43268 | 0.40934 |
374 | Treatment | M | 61 | 7.03 | 28.32 | 3 | 20 | 2936 | 3 | 1 | Treatment | 0.81985 | 0.69421 | 1.44050 | 0.41157 |
179 | Treatment | M | 76 | 8.01 | 26.44 | 2 | 20 | 2741 | 3 | 1 | Treatment | 0.79273 | 0.68842 | 1.45261 | 0.41503 |
68 | Treatment | M | 64 | 8.87 | 27.89 | 2 | 20 | 2766 | 4 | 1 | Treatment | 0.77461 | 0.68452 | 1.46088 | 0.41740 |
9 | Treatment | M | 70 | 8.57 | 26.89 | 2 | 20 | 2529 | 3 | 1 | Treatment | 0.75219 | 0.67966 | 1.47133 | 0.42038 |
159 | Treatment | M | 77 | 8.22 | 27.41 | 3 | 20 | 2760 | 1 | 1 | Treatment | 0.73466 | 0.67583 | 1.47967 | 0.42276 |
12 | Treatment | M | 52 | 7.65 | 25.75 | 2 | 19 | 2893 | 2 | 1 | Treatment | 0.70801 | 0.66996 | 1.49262 | 0.42646 |
293 | Treatment | M | 73 | 8.37 | 29.79 | 3 | 20 | 2959 | 2 | 1 | Treatment | 0.70024 | 0.66824 | 1.49647 | 0.42756 |
169 | Treatment | F | 63 | 7.38 | 25.56 | 3 | 20 | 1707 | 3 | 1 | Treatment | 0.67746 | 0.66317 | 1.50791 | 0.43083 |
297 | Treatment | M | 79 | 8.74 | 29.3 | 2 | 20 | 2706 | 4 | 0 | Treatment | 0.66387 | 0.66013 | 1.51486 | 0.43282 |
166 | Treatment | M | 66 | 7.27 | 25.24 | 3 | 19 | 2830 | 2 | 1 | Treatment | 0.64981 | 0.65697 | 1.52215 | 0.43490 |
190 | Treatment | M | 66 | 8.83 | 29.26 | 3 | 20 | 2443 | 2 | 1 | Treatment | 0.64719 | 0.65638 | 1.52351 | 0.43529 |
354 | Treatment | M | 55 | 7.93 | 26.08 | 3 | 19 | 2798 | 2 | 1 | Treatment | 0.64312 | 0.65546 | 1.52565 | 0.43590 |
44 | Treatment | F | 52 | 7.54 | 28.17 | 3 | 20 | 1778 | 3 | 1 | Treatment | 0.63979 | 0.65471 | 1.52741 | 0.43640 |
278 | Treatment | M | 77 | 7.76 | 25.36 | 3 | 19 | 2958 | 2 | 1 | Treatment | 0.61542 | 0.64918 | 1.54041 | 0.44012 |
184 | Treatment | M | 76 | 8.2 | 25.44 | 3 | 19 | 2990 | 1 | 0 | Treatment | 0.61228 | 0.64846 | 1.54211 | 0.44060 |
210 | Treatment | M | 52 | 7.99 | 28.47 | 3 | 19 | 2991 | 2 | 1 | Treatment | 0.60557 | 0.64693 | 1.54576 | 0.44165 |
283 | Treatment | M | 52 | 7.44 | 28.47 | 4 | 19 | 2990 | 2 | 1 | Treatment | 0.59696 | 0.64496 | 1.55048 | 0.44300 |
389 | Treatment | F | 56 | 8.85 | 28.2 | 3 | 20 | 1779 | 4 | 1 | Treatment | 0.59534 | 0.64459 | 1.55137 | 0.44325 |
360 | Treatment | M | 60 | 8.69 | 27.01 | 2 | 19 | 2779 | 1 | 1 | Treatment | 0.59388 | 0.64426 | 1.55218 | 0.44348 |
235 | Treatment | F | 62 | 7.38 | 27.62 | 3 | 20 | 1596 | 3 | 1 | Treatment | 0.59351 | 0.64417 | 1.55239 | 0.44354 |
124 | Treatment | M | 52 | 7.48 | 26.85 | 3 | 19 | 2497 | 3 | 1 | Treatment | 0.58766 | 0.64283 | 1.55562 | 0.44446 |
261 | Treatment | F | 64 | 8.43 | 27.8 | 3 | 20 | 1767 | 4 | 0 | Treatment | 0.58588 | 0.64242 | 1.55661 | 0.44475 |
356 | Treatment | F | 57 | 7.97 | 29.4 | 2 | 20 | 1741 | 2 | 1 | Treatment | 0.58467 | 0.64214 | 1.55729 | 0.44494 |
and the procedure I want to run
proc lifetest data=iptw_db atrisk plots=survival(failure cl);
strata trt;
weight iptw; *the variable is iptws for stabilized weights;
time event_time*status(0);
run;
Many thanks!!
You must be running an old version of SAS. Your program runs without error in SAS 940m5.
I found a SAS NOTE that talks about an error when using the STRATA statement in PROC LIFEREG and also requesting the survival plot. Try removing the survival plot request (get rid of the PLOTS= option) and see if that enables your analysis to complete.
Thank you! I tried to get rid of the PLOTS=.. but I got the same error; in any case, unfortunately, I am interested in the weighted survival plot. My SAS version is 9.4 M5 on SAS Studio. I have to find a solution.. maybe writing che code without any procedure.
I'm confused by your statement that you are running SAS 9.4 M5 because that is what I am running.
To make sure that we are running the same data, can you run the following and report what happens?
data iptw_db;
input count trt $ sex $ age V1 V2 V3 V4 V5 event_time status logit_ps ps iptw iptws;
datalines;
390 Treatment M 74 7.25 25.9 3 20 2880 2 1 0.83789 0.69802 1.43262 0.40932
344 Treatment M 60 7.35 28.41 2 20 2958 3 1 0.83777 0.69799 1.43268 0.40934
374 Treatment M 61 7.03 28.32 3 20 2936 3 1 0.81985 0.69421 1.44050 0.41157
179 Treatment M 76 8.01 26.44 2 20 2741 3 1 0.79273 0.68842 1.45261 0.41503
68 Treatment M 64 8.87 27.89 2 20 2766 4 1 0.77461 0.68452 1.46088 0.41740
9 Treatment M 70 8.57 26.89 2 20 2529 3 1 0.75219 0.67966 1.47133 0.42038
159 Treatment M 77 8.22 27.41 3 20 2760 1 1 0.73466 0.67583 1.47967 0.42276
12 Treatment M 52 7.65 25.75 2 19 2893 2 1 0.70801 0.66996 1.49262 0.42646
293 Treatment M 73 8.37 29.79 3 20 2959 2 1 0.70024 0.66824 1.49647 0.42756
169 Treatment F 63 7.38 25.56 3 20 1707 3 1 0.67746 0.66317 1.50791 0.43083
297 Treatment M 79 8.74 29.3 2 20 2706 4 0 0.66387 0.66013 1.51486 0.43282
166 Treatment M 66 7.27 25.24 3 19 2830 2 1 0.64981 0.65697 1.52215 0.43490
190 Treatment M 66 8.83 29.26 3 20 2443 2 1 0.64719 0.65638 1.52351 0.43529
354 Treatment M 55 7.93 26.08 3 19 2798 2 1 0.64312 0.65546 1.52565 0.43590
44 Treatment F 52 7.54 28.17 3 20 1778 3 1 0.63979 0.65471 1.52741 0.43640
278 Treatment M 77 7.76 25.36 3 19 2958 2 1 0.61542 0.64918 1.54041 0.44012
184 Treatment M 76 8.2 25.44 3 19 2990 1 0 0.61228 0.64846 1.54211 0.44060
210 Treatment M 52 7.99 28.47 3 19 2991 2 1 0.60557 0.64693 1.54576 0.44165
283 Treatment M 52 7.44 28.47 4 19 2990 2 1 0.59696 0.64496 1.55048 0.44300
389 Treatment F 56 8.85 28.2 3 20 1779 4 1 0.59534 0.64459 1.55137 0.44325
360 Treatment M 60 8.69 27.01 2 19 2779 1 1 0.59388 0.64426 1.55218 0.44348
235 Treatment F 62 7.38 27.62 3 20 1596 3 1 0.59351 0.64417 1.55239 0.44354
124 Treatment M 52 7.48 26.85 3 19 2497 3 1 0.58766 0.64283 1.55562 0.44446
261 Treatment F 64 8.43 27.8 3 20 1767 4 0 0.58588 0.64242 1.55661 0.44475
356 Treatment F 57 7.97 29.4 2 20 1741 2 1 0.58467 0.64214 1.55729 0.44494
;
proc lifetest data=iptw_db atrisk plots=survival(failure cl);
strata trt;
weight iptw; *the variable is iptws for stabilized weights;
time event_time*status(0);
run;
This code produces the plot I need but the dataset I copied in the previous post is just a portion of the whole dataset. So, the error must be related to the dataset.
I am facing the similar issue, Domain error , floating point exception. Can you tell what was the problem with the dataset that you were unable to run analysis on entire data. It would be great if you reply ASAP.
Thanks in advance
Do you get the error for the data set in this thread?
If you get the error for some data but not for other data, then something about the data is causing the problem. Sometimes you can determine the problem by running the program on a subset of the data. For example, if the problem goes away when you use
proc lifetest data=Have(OBS=500);
then that is valuable information.
If you can post your data here, then please do. If you cannot post your data because it is too large (or proprietary), then open a ticket with SAS Technical Support. They can make arrangements to obtain the data.
I cannot share the data due to certain constraints, actual data has more than 50k observations, we tried running with (obs=500) and (obs=1000) the model gave output. We also tried running the model with weight = 1 still we faced the domain error.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.