Hi, I have a dataset with 5 groups where I needed to impute some missing observations. I want to make a contingency table (on all subjects with and without imputed values) giving the distribution in absolute number and percentage of some variables of interest by group (proc freq table with chisq test if I had no missing data).
So far, I have been able to get a test for between group differences and groupwise estimates for difference from the reference group using the code below. But how can I get an estimate of the calculated percentages from proc mianalyze in each group?
I tried to ask for lsmeans in proc logistic but get the error:
WARNING: The model does not have a GLM parameterization. This parameterization is required for
the LSMEANS, LSMESTIMATE, and SLICE statement. These statements are ignored
Any help would be much appreciated. Thanks!
Here is my full code:
proc surveyimpute data=have method=hotdeck(selection=abb)
ndonors=5 seed=773269;
var x1 x2 x3 x4 x5;
cells imputecell;
output out=ABB;
id id;
run;
data DAIMP;
set ABB;
if (ImpIndex = 0) then do;
do _Imputation_=1 to 5;
output;
end;
end;
else do;
_Imputation_ = ImpIndex;
output;
end;
proc sort data=DAIMP;
by _Imputation_ ImpIndex;
run;
ods select none;
proc surveylogistic data=DAIMP;
by _imputation_;
class treatment group;
model treatment=group / covb;
ods output parameterestimates=Estimates covb=Covariances;
run;
ods select all;
proc mianalyze parms(classvar=classval)=Estimates
covb(effectvar=stacking)=Covariances
edf=25;
class group;
modeleffects Intercept group;
ods output parameterestimates=ABBLogisticAnalysis;
run;
ods select none;
proc logistic data=DAIMP;
class group(order=internal);
model treatment(event='1')= group / covb; /* this gives at test for between group differences in treatment with
by _Imputation_;
ods output ParameterEstimates=lgsparms;
run;
ods select all;
proc mianalyze parms(classvar=classval)=lgsparms;
modeleffects group;
run;
I did face this same problem when I was working on a project. The reason why mianalyze does not give a single estimate for percentage across imputations is that percentage calculations do not have a standard error.
What you could do instead is to report the percentage across all n (number) imputations (removing the by statement in your proc freq code). But you cannot report # observations in each group still. Hope it helps.
For the error that you are receiving in logistic you can use param=GLM in the class statement.
1. Pasta DJ. Parameterizing Models to Test the Hypotheses You Want: Coding Indicator Variables and Modified Continuous Variables. http://www2.sas.com/proceedings/sugi30/212-30.pdf. Accessed December 6, 2018.
Thanks. But SAS won't estimate calculated percentages because there are no standard error estimates on the reference group. Proc freq might be a solution using something like this:
ods trace on;
proc freq data=DAIMP;
table treatment*group / CROSSLIST(STDRES);
by _Imputation_;
run;
ods trace off;
But how can I get the calculated #observations and percentages of treatment*group from proc mianalyze?
I did face this same problem when I was working on a project. The reason why mianalyze does not give a single estimate for percentage across imputations is that percentage calculations do not have a standard error.
What you could do instead is to report the percentage across all n (number) imputations (removing the by statement in your proc freq code). But you cannot report # observations in each group still. Hope it helps.
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 16. Read more here about why you should contribute and what is in it for you!
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.