BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mconover
Quartz | Level 8

 

Hello SAS community,

 

Thanks in advance for your help / interest in my question.  I've searched around for this topic online and haven't found much guidance so I decided to post here.  I am having trouble with a multiple imputation model (which I run using PROC MI) which seemed to be running just fine a few days ago but now seems to be producing an error.  I am imputing values for four ordinal categorical (3 categories) variables which contain missing values.  I am imputing using logistic regression and fully conditional specification. Like I said, this code was running great until recently, now I cannot figure out what I did to the code that might have changed what used to run properly.  Please note I am running PROC MI within a macro call, hence the macro variables. Below this message, I've included the SAS code for my PROC MI run as well as the erroneous log output. Also note I'm using SAS Version 9.4.

 

When I run my PROC MI, my log contains an error reading: "ERROR: An exception has been encountered. Please contact technical support and provide them with the following traceback information: The SAS task name is [MI Segmentation Violation".  The more interpretable warning that accompanies this error states WARNING: An effect for variable a1c_ord_1yr is a linear combination of other effects. The coefficient of the effect will be set to zero in the imputation.

 

I could be missing something but as far as i can tell, none of the variables I'm imputing (i.e. a1c_ord_1yr, ldl_ord_1yr, sbp_ord_1yr, or dbp_ord_1yr) are linear combinations of other effects.  Note that I have also tried to resolve the log error by changing the nimpute (number of imputation), nbiter (number of burn-in iterations) and the seed.  None of these seemed to work.

 

If anyone has any intuition RE: what might cause the above errors please let me know.  I do have the ability to contact SAS technical support (as instructed in the log) via my institution but thought I'd check with the community first. Please let me know if there's anything that I can do to provide more information. Thank you for your help. 

 

SAS CODE THAT PRODUCES ERROR (MACRO AND MACRO CALL)

 

/*STEP 1:MISSING data Pattern*/
/****************************/
%macro mi(status, lb, Strat, ordinal, bootstrap);

*Number of bootstrap resamples*;
%IF bootstrap=Y %THEN %LET NumSamples = 2; %ELSE %LET NumSamples = 1;;
*Generate many bootstrap samples*;
proc surveyselect data=cohort_&lb._lookback NOPRINT seed=1
out=cohort_&lb._lookback_BS(rename=(Replicate=SampleID))
method=urs /* resample with replacement */
samprate=1 /* each bootstrap sample has N observations */
/* OUTHITS option to suppress the frequency var */
reps=&NumSamples; /* generate NumSamples bootstrap resamples */
run;

proc sort data=work.cohort_&lb._lookback_BS;
%IF &Strat.=Gender %THEN %DO; BY SampleID GENDER; %END;;
%IF &Strat.=Age %THEN %DO; BY SampleID age_bin; %END;;
%IF &Strat.=GenderAge %THEN %DO; BY SampleID GENDER age_bin; %END;;
run;

proc mi nimpute=3 seed=1234 data=work.cohort_&lb._lookback_BS simple OUT=cohort_&lb._lookback_MI_BS;
%IF &Strat.=Gender %THEN %DO; BY SampleID GENDER; %END;;
%IF &Strat.=Age %THEN %DO; BY SampleID age_bin; %END;;
%IF &Strat.=GenderAge %THEN %DO; BY SampleID GENDER age_bin; %END;;
CLASS
%IF ((&Strat.=Gender) or (&Strat.=)) %THEN AGECAT;
%IF ((&Strat.=Age) or (&Strat.=)) %THEN GENDER;
YEAR RACE
OUTPTVISIT_&lb._cat
SNF_&lb._cat
HS_&lb._cat
UniqueDrugs_&lb._cat
%IF &ordinal=N %THEN a1c_&lb. ldl_&lb. sbp_&lb. dbp_&lb.;
%ELSE a1c_ord_&lb. ldl_ord_&lb. sbp_ord_&lb. dbp_ord_&lb.;;
VAR &status. StatinInitiator
%IF &ordinal=N %THEN a1c_&lb. ldl_&lb. sbp_&lb. dbp_&lb.;
%ELSE a1c_ord_&lb. ldl_ord_&lb. sbp_ord_&lb. dbp_ord_&lb.;
/*Class variables*/
/*Need to omit the agecat variable whenever we stratify by age since the
values will be non-overlapping within age strata*/
%IF ((&Strat.=Gender) or (&Strat.=)) %THEN AGECAT;
YEAR RACE
/*LS_&lb._cat*/
/*SS_&lb._cat*/
OUTPTVISIT_&lb._cat
SNF_&lb._cat
HS_&lb._cat
UniqueDrugs_&lb._cat
/*Continuous variables*/
AGEyrs Age_sq
/*LS_&lb.*/
/*SS_&lb.*/
SNF_&lb.
UniqueDrugs_&lb.
HS_&lb.
OUTPTVISIT_&lb.
/*Binary variables*/
AFIB_&lb.
AMBLIFESUPPORT_&lb.
ANEMIA_&lb.
ANGIOGRAPHY_&lb.
ARB_&lb.
ASTHMA_&lb.
CANCERSCREEN_&lb.
CKD_&lb.
COLONOSCOPY_&lb.
COPD_&lb.
DEMENTIA_&lb.
DIURETICS_&lb.
ECHOCARDIOGRAPH_&lb.
FECALOCCULT_&lb.
%IF ((&Strat=Age) or (&strat=)) %THEN GENDER;
HOMEOXYGEN_&lb.
HSCRP_&lb.
HYPERLIPIDEMIA_&lb.
INCL_ENDARTERECTOMY
INCL_STROKE
INFLAMBOWEL_&lb.
INSULIN_&lb.
LIPIDPANEL_&lb.
OBESITY_&lb.
OSTEOARTHRITIS_&lb.
PARALYSIS_&lb.
PCD_&lb.
PSYCHIATRIC_&lb.
PVD_&lb.
SEPSIS_&lb.
SMOKING_&lb.
STRESSTEST_&lb.
SUBABUSE_&lb.
SULFONYLUREA_&lb.
THIAZIDE_&lb.
VERTIGO_&lb.
VTE_&lb.
WEAKNESS_&lb.
WHEELCHAIR_&lb.;
FCS nbiter=10 /*Default is 10*/
logistic(%IF &ordinal=N %THEN a1c_&lb. ldl_&lb. sbp_&lb. dbp_&lb.;
%ELSE a1c_ord_&lb. ldl_ord_&lb. sbp_ord_&lb. dbp_ord_&lb.;
/ details link=glogit likelihood=augment ORDER=FREQ);
run;

%MEND mi;

%mi(status=STATUS_death, lb=1yr, Strat=GenderAge, ordinal=Y, bootstrap=N);

 

 

SAS LOG CONTAINING ERROR

 

MPRINT(MI): proc mi nimpute=3 seed=1234 data=work.cohort_1yr_lookback_BS simple
OUT=cohort_1yr_lookback_MI_BS;
MLOGIC(MI): %IF condition &Strat.=Gender is FALSE
MPRINT(MI): ;
MLOGIC(MI): %IF condition &Strat.=Age is FALSE
MPRINT(MI): ;
MLOGIC(MI): %IF condition &Strat.=GenderAge is TRUE
MPRINT(MI): BY SampleID GENDER age_bin;
MPRINT(MI): ;
MLOGIC(MI): %IF condition ((&Strat.=Gender) or (&Strat.=)) is FALSE
MLOGIC(MI): %IF condition ((&Strat.=Age) or (&Strat.=)) is FALSE
MLOGIC(MI): %IF condition &ordinal=N is FALSE
MPRINT(MI): CLASS YEAR RACE OUTPTVISIT_1yr_cat SNF_1yr_cat HS_1yr_cat UniqueDrugs_1yr_cat
a1c_ord_1yr ldl_ord_1yr sbp_ord_1yr dbp_ord_1yr;
MLOGIC(MI): %IF condition &ordinal=N is FALSE
MLOGIC(MI): %IF condition ((&Strat.=Gender) or (&Strat.=)) is FALSE
MLOGIC(MI): %IF condition ((&Strat=Age) or (&strat=)) is FALSE
MPRINT(MI): VAR STATUS_death StatinInitiator a1c_ord_1yr ldl_ord_1yr sbp_ord_1yr dbp_ord_1yr YEAR
RACE OUTPTVISIT_1yr_cat SNF_1yr_cat HS_1yr_cat UniqueDrugs_1yr_cat AGEyrs Age_sq SNF_1yr
UniqueDrugs_1yr HS_1yr OUTPTVISIT_1yr AFIB_1yr AMBLIFESUPPORT_1yr ANEMIA_1yr ANGIOGRAPHY_1yr ARB_1yr
ASTHMA_1yr CANCERSCREEN_1yr CKD_1yr COLONOSCOPY_1yr COPD_1yr DEMENTIA_1yr DIURETICS_1yr
ECHOCARDIOGRAPH_1yr FECALOCCULT_1yr HOMEOXYGEN_1yr HSCRP_1yr HYPERLIPIDEMIA_1yr INCL_ENDARTERECTOMY
INCL_STROKE INFLAMBOWEL_1yr INSULIN_1yr LIPIDPANEL_1yr OBESITY_1yr OSTEOARTHRITIS_1yr PARALYSIS_1yr
PCD_1yr PSYCHIATRIC_1yr PVD_1yr SEPSIS_1yr SMOKING_1yr STRESSTEST_1yr SUBABUSE_1yr SULFONYLUREA_1yr
THIAZIDE_1yr VERTIGO_1yr VTE_1yr WEAKNESS_1yr WHEELCHAIR_1yr;
MLOGIC(MI): %IF condition &ordinal=N is FALSE
MPRINT(MI): FCS nbiter=10 logistic( a1c_ord_1yr ldl_ord_1yr sbp_ord_1yr dbp_ord_1yr / details
link=glogit likelihood=augment ORDER=FREQ);
MPRINT(MI): run;

 

WARNING: An effect for variable a1c_ord_1yr is a linear combination of other effects. The coefficient
of the effect will be set to zero in the imputation.
WARNING: An effect for variable ldl_ord_1yr is a linear combination of other effects. The coefficient
of the effect will be set to zero in the imputation.

 

ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

 

The SAS task name is [MI ]
Segmentation Violation

 

Traceback of the Exception:

 

/opt/sas/SASHome/SASFoundation/9.4/sasexe/sas(+0x15cfde) [0x5593446d5fde]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sas(+0x4cb7b) [0x5593445c5b7b]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/tkmk.so(bkt_signal_handler+0x144) [0x7fa75e0d0404]
/lib64/libpthread.so.0(+0xf5d0) [0x7fa75f3405d0]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/tkmk.so(skm_frontlink+0xf4) [0x7fa75e0e37b4]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/tkmk.so(skmMemRelease+0x310) [0x7fa75e0e1eb0]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sasmi(+0x4a5a4) [0x7fa7059135a4]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sasmi(+0x53816) [0x7fa70591c816]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sasmi(mipfcs1+0x194) [0x7fa70590abf4]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sasmi(+0x1923b) [0x7fa7058e223b]
/opt/sas/SASHome/SASFoundation/9.4/sasexe/sas(vvtentr+0x13d) [0x5593445c571d]
/lib64/libpthread.so.0(+0x7dd5) [0x7fa75f338dd5]
/lib64/libc.so.6(clone+0x6d) [0x7fa75e924ead]

 

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.COHORT_1YR_LOOKBACK_MI_BS may be incomplete. When this step was stopped
there were 139698 observations and 1490 variables.
NOTE: The PROCEDURE MI printed pages 13-117.
NOTE: PROCEDURE MI used (Total process time):
real time 5:40.89
cpu time 5:39.59

1 ACCEPTED SOLUTION

Accepted Solutions
mconover
Quartz | Level 8

Thanks for the advice - I went ahead and contacted SAS Technical Service and they quickly helped me with a solution. I'll share here briefly in case anyone has this problem in the future and stumbles across my post.  SAS Technical Service gave me two pieces of advice:

  1. Remove the SIMPLE option from my code, and
  2. In the FCS statement, use the DISCRIM method instead of LOGISTIC

Doing #1 above did not solve my issue.  However, removing the LOGISTIC statement and instead using the DISCRIM method did resolve my errors and produced what appear to be reasonable imputations.

 

I'll also mention - in a separate SAS Discussion Forum post, I found a recommendation for how to check if a variable in your data is a linear combination of effects using PROC CORR or PROC PRINCOMP. By using these methods, I was able to confirm that the error I was seeing was not a result of my variables being a linear combination of other effects.  If you suspect your variable may be a combination of linear effects, I would recommend using these PROCs to confirm.

 

 

View solution in original post

2 REPLIES 2
SAS_Cares
SAS Employee

We would recommend that you contact technical support on the issue you are experiencing. You can email to support@sas.com or create your track here https://support.sas.com/en/technical-support/contact-sas.html Also note for future posts, you can post under the SAS Statistical Procedures community if you would like your post to be viewed by more experts https://communities.sas.com/t5/Statistical-Procedures/bd-p/statistical_procedures

mconover
Quartz | Level 8

Thanks for the advice - I went ahead and contacted SAS Technical Service and they quickly helped me with a solution. I'll share here briefly in case anyone has this problem in the future and stumbles across my post.  SAS Technical Service gave me two pieces of advice:

  1. Remove the SIMPLE option from my code, and
  2. In the FCS statement, use the DISCRIM method instead of LOGISTIC

Doing #1 above did not solve my issue.  However, removing the LOGISTIC statement and instead using the DISCRIM method did resolve my errors and produced what appear to be reasonable imputations.

 

I'll also mention - in a separate SAS Discussion Forum post, I found a recommendation for how to check if a variable in your data is a linear combination of effects using PROC CORR or PROC PRINCOMP. By using these methods, I was able to confirm that the error I was seeing was not a result of my variables being a linear combination of other effects.  If you suspect your variable may be a combination of linear effects, I would recommend using these PROCs to confirm.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1790 views
  • 0 likes
  • 2 in conversation