Hi all,
I'm experiencing an error using PROC MIANALYZE:
I have a single measure, Y, that is repeated 13 separate times (Y0 - Y12). There is a varied amount of missing throughout each of the individual timepoints. My intention is to multiply impute the missing at each time point sequentially, using the historical data at the subsequent time points as the independent variables in the regressions (e.g. predicting Y1 from Y0, predicting Y2 from Y0 and Y1, predicting Y3 from Y2 and Y1...etc.). I did this successfully with the following code:
proc mi data = data seed=17655417 out=MonotoneMiss nimpute=1 minmaxiter=3000 noprint;
mcmc impute=monotone;
var Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12;
run;
proc sort data = MonotoneMiss;
by VAR;
run;
proc mi data = MonotoneMiss seed=123 out=miHistory nimpute=50 noprint;
by VAR;
fcs reg(Y1=Y0);
fcs reg(Y2 = Y1 Y0);
fcs reg(Y3 = Y2 Y1);
fcs reg(Y4 = Y3 Y2);
fcs reg(Y5 = Y4 Y3);
fcs reg(Y6 = Y5 Y4);
fcs reg(Y7 = Y6 Y5);
fcs reg(Y8 = Y7 Y6);
fcs reg(Y9 = Y8 Y7);
fcs reg(Y10 = Y9 Y8);
fcs reg(Y11 = Y10 Y9);
fcs reg(Y12= Y11 Y10);
var Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12;
run;
I then used the following code to create change scores and then transposed the data wide-to-long:
data miHistory;
set miHistory;
YChange1 = Y1 - Y0;
YChange2 = Y2 - Y1;
YChange3 = Y3 - Y2;
YChange4 = Y4 - Y3;
YChange5 = Y5 - Y4;
YChange6 = Y6 - Y5;
YChange7 = Y7 - Y6;
YChange8 = Y8- Y7;
YChange9 = Y9- Y8;
YChange10 = Y10 - Y9;
YChange11 = Y11 - Y10;
YChange12 = Y12 - Y11;
YChangePrePost = Y12 - Y0;
run;
proc sort data=miHistory;
by _IMPUTATION_;
run;
data miHistoryLong;
set miHistory;
array ArrayName (13) ;
do i = 1 to 13;
session = i;
sessionChange = YChange(i);
output;
end;
run;
With the transposed data, I sorted by _IMPUTATION_ and then performed a repeated measures regression using Proc Mixed as follows:
proc mixed data = miHistoryLong plots = all order = data method = ml;
by _imputation_;
class ID VAR session;
model sessionChange = VAR/ solution covb alpha = .1;
repeated session / subject = ID type = AR(1) rcorr;
lsmeans VAR / diff cl alpha = .1;
ods output SolutionF = mixParms CovB = mixCovB;
run;
I concluded by trying to use proc mianalyze with the parameter estimates and covariance estimates output from the repeated measures model:
proc mianalyze parms=mixParms covb(effectvar=rowcol)=mixCovB alpha = 0.1;
modeleffects Intercept VAR;
run;
When I do this, I get an error: "WARNING: The within-imputation covariance matrix is singular. The total covariance matrix and
related statistics in multivariate inference will be set to missing." I don't have a valid estimate for the effects of VAR, which is my primary interest.
Any thoughts on how to troubleshoot this problem?
Thanks and Best,
Luke
Hi,
You don't seem to have a specific variable identified for the standard error. The following is code that I have used successfully previously (for a GEE analysis):
proc mianalyze data = xxxx;
modeleffects xxxxxxx;
stderr xxxxxx;
run;
I am by no means an expert on proc MI/MIANALYZE but may be worth a try.
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.