BookmarkSubscribeRSS Feed
Saifulinfs
Fluorite | Level 6

I wish to get the 90th percentile values for each level of a domain variable (e.g., sex) after running the proc MIANALYZE. But I only see one row of estimate. How to see the estimate for both males and females? When I run the code it gives error: "ERROR: At least two imputations are required for PROC MIANALYZE."

 

Here is my code:

 

proc sort data=zinc.imputed out=imputed;
by _imputation_;
run;
proc surveymeans data = imputed percentile = (90);
by _imputation_;
weight imp_wt;
cluster psu_no_ov;
strata newstrata;
var N_Mets7;
domain sex;
ods output DOMAINQUANTILES =stat1;
run;
proc mianalyze data= stat1 edf=2191;
modeleffects estimate;

by sex notsorted;
stderr stderr;
ods output parameterestimates = MI_results_wc;
run;

 

 

5 REPLIES 5
sbxkoenk
SAS Super FREQ

Hello,

Can you show your PROC MI ??

Koen

Saifulinfs
Fluorite | Level 6

I wish to estimate the median of a variable (here, N_Mets1) across the quartiles of serum zinc level (variable: cat_zinc). At the same time I wish to stratify the estimate by gender (variable: sex). Below is my code. How to edit the code for PROC MIANALYZE because the current syntax outputs that shows something as if there is missing value in my sex and cat_zinc variable.

proc surveymeans data = zinc.imputed percentile=(50);
by _imputation_;
weight imp_wt;
cluster psu_no_ov;
strata newstrata;
var N_Mets1;
domain cat_zinc sex;
ods output DOMAINQUANTILES =stat1;
run;
proc sort data=stat1 out=sta2;
by cat_zinc sex _imputation_;

proc mianalyze data= sta2 edf=2191;
by cat_zinc sex;
modeleffects estimate;
stderr stderr;
ods output parameterestimates = MI_results_zinc;
run;


sbxkoenk
SAS Super FREQ

Hello,

 

I cannot see your code.

Do not provide us with your code in *.png (graphics) format.

Use the <running man square icon> in the toolbar (paste your code in the pop-up window).

 

Here's an example with proc surveyphreg instead of your proc surveymeans :

Usage Note 63275: Combining the results from PROC SURVEYPHREG in PROC MIANALYZE
https://support.sas.com/kb/63/275.html

(it also includes gender as an effect of interest)

 

Cheers,

Koen

 
SAS_Rob
SAS Employee

When you have multiple DOMAIN variables, the ODS table will contain multiple variables for each of the domains.  The missing values occur when the estimate is associated with one of the domains of the other variable.  If you examine the data set before feeding it into MIANALYZE then it will make sense.

Notice in the example below how the data set is formatted.  The first two observations are associated with DOMVAR1 (levels 1 &2) and the next two are associated with DOMVAR2 (also with 3 levels).  There are missing values for the DOMVAR1 anytime the estimate is for a level of DOMVAR2 and vice versa.

data sample;
do _imputation_=1 to 2;
do domvar1=1 to 2;
do domvar2=1 to 2;
do stratvar=1 to 2;
do rep=1 to 50;
y=.95+rannor(123);
output;
end;
end;
end;
end;end;
drop rep;
run;
proc surveymeans data=sample mean std nobs percentile=(50);
by _imputation_;
domain domvar1 domvar2;
strata stratvar;
var y ;
ods output domainquantiles=quant_imp;
run;
proc print data=quant_imp;
run;

It might be that this isn't what you intend as far as the domain analysis is concerned.  This treats each unique level of the two variables as a separate domain and thus in my example there are 5 levels.  It might be that you are expecting that the domains should be crossed, that is in my example, have 6 levels.  Then you should put the crossed variables on the domain statement.

proc surveymeans data=sample mean std nobs percentile=(50);
by _imputation_;
domain domvar1*domvar2;
strata stratvar;
var y ;
ods output domainquantiles=quant_imp;
run;

This would mean there would be no missing values in either variable.

 

SAS_Rob
SAS Employee

I suspect you already figured the first part out, but you need to sort the WORK.STAT1 data set by sex _imputation_;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 1196 views
  • 1 like
  • 3 in conversation