turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc Mianalyze: obtaining combined results for cat...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-08-2013 05:53 AM

Hello,

I wonder if it is possible to obtain an overall result for a comparison of means for a categorical variable.

The standard SAS codes show how to obtain combined parameter estimates (for each of the levels of my variable),

but I haven't found instructions on how to obtain combined overall p-values for categorical variables anywhere.

The "outstats=xxx" option in proc glm (by _imputation_) allows me to obtain overall p-values for each imputation.

But I cannot combine them simply by stating proc mianalyze data=XXX as SAS will not recognize the variables

listed under _SOURCE_ as modeleffects.

Thank you very much in advance for any ideas on this!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-08-2013 07:36 AM

Hi Karen,

Check out Example 58.6 Reading GLM Results from PARMS= and XPX!= Data Sets in the documentation, and Example 58.8 Reading Mixed Model Results with Classification Variables. You will probably have to add a TEST statement to get what you are finally looking for.

If these examples don't get you started in the right direction, please provide additional details.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-08-2013 10:33 AM

Thank you very much for your answer! I could not really work out how to get results for the overall F-test from these examples. However, when looking for how to combine imputed results on LS-Means, I found this document (that also covers a solution for the F-test problem) A Method of Using Multiple Imputation in Clinical Data Analysis | www.pnwsug.org

I have not tried it yet but I hope it will work!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-08-2013 11:02 AM

Interesting paper and approach to getting LSmeans and the associated standard errors. I have, however, "great fear and loathing" about the calculation of standard errors for the differences between LSmeans across imputation, as I don't see a variance-covariance matrix in the code in Example 7. I fear that without the covariances, somehow averaged over imputations, the standard errors of the differences will be off. See https://communities.sas.com/message/149498#149498 for more on this, where it becomes apparent that the assumption of independence between variables and levels of variables leads to mis-estimation of standard errors of the differences between LSmeans (and that would be the loathing part, because it was my mistake). If this is where you eventually need to be (comparing levels of fixed effects after imputation), then it is going to get much more difficult.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 08:54 AM

Thank you for the critical comments! It's a pity that multiple imputation still is quite complicated for certain types of analysis - I hope it will get more easily applicable in the future!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 10:39 AM

Hi Karen,

Can you provide specific code for what you have done to circumvent this problem?

I suspect I am encouring a similar issue. I want to obtain an overall Fand p value for treatment (from the mianalyze step) for a model that has a 3-level categorical predictor (3 different types of treatment).

I get a warning message when I run the glm step.

proc glm data = XX;

class tx_condition;

model continuous_dv = continuous_iv tx_condition/inverse;

by _imputation_;

ods output

parameterestimates = glmparms

invxpx = glmpxi;

run;

***WARNING MESSAGE:

'ParameterEstimates' was not created. ****

Then when I turn to step 3 (mianalyze) I get an error.

proc mianalyze;

class tx_condition;

model effects intercept continuous_iv tx_condition;

parms = glmparms;

xpxi = glmpxi edf = 218;

run;

*** ERROR MESSAGE:

Parms Statement is not valid or it is used out of proper order***

I have read around and suspect it's an issue with the class statement but I'm not sure how to get around this problem.

Thanks in advance for any thoughts/suggestions!

Amy

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 11:33 AM

Amy,

On the proc mianalyze front, the parms=, xpxi=, and edf= statements should be made options in the proc mianalyze statement. That is:

proc mianalyze parms(classvar=full)=glmparms xpxi=glmpxi edf=218;

/* Note the inclusion of the classvar= option to indicate that there are categorical variables */

class tx_condition;

model effects intercept continuous_iv tx_condition;

run;

For the proc glm, add solution as an option after inverse.

Good luck.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 11:39 AM

Hi Amy,

I am not sure if I'll be of great help as I am absolutely new to multiple imputation myself.

I did notice that SAS won't create the "parameterestimates=" output if you don't specify /solution clparms

(or only one of the two, I am not sure).

As in model y = x / solution inverse clparm

I'm still working on my code and figuring out what exactly to put. Good luck with your work!

Karen

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 11:41 AM

ok, I was too late .

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 11:55 AM

However, when I use exactly this code, I get:

"ERROR: The XPXI= data set can not be used with CLASS variables or effects." ...

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 01:07 PM

More digging. So in the Details part of the documentation, under Input Data Sets, in the very last sentence: "Note that this combination can be used only when each effect is a continuous variable by itself." (referring to PARMS= and XPXI=).

Where I would go now. Use PROC MIXED rather than PROC GLM. This should not add any additional concerns, and will provide additional flexibility if random or repeated factors are included in the model. The options that apply then will be PARMS(CLASSVAR=FULL)= and COVB(EFFECTVAR=ROWCOL)=

So, something like:

proc mixed data = XX;

class tx_condition;

model continuous_dv = continuous_iv tx_condition/covb solution;

by _imputation_;

ods output

solutionf = glmparms

covb = glmcovb;

run;

proc mianalyze parms(classvar=full)=glmparms covb(effectvar=rowcol)=glmcovb edf=218;

/* Note the inclusion of the classvar= option to indicate that there are categorical variables */

/* Also the use of the covb option to get the covariance matrix into mianalyze */

class tx_condition;

model effects intercept continuous_iv tx_condition;

run;

Maybe this one will work better.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 03:22 PM

Thank you both VERY MUCHfor your help. Proc mixed seems to work except that I cannot get a main effect for tx_condition from the mianalyze statement -- I only get specific comparisons to the control/reference group. Is there a way to specify things to get that overall F (and p value) for my categorical predictor tx_condition (with 3 levels). I think this is similar to the question Karen had previously.

Amy

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2013 03:58 PM

I know it involves the MULT option in the PROC MIANALYZE statement, but if there are multiple class variables, I am stuck. That is where the TEST statement comes in. Unfortunately, the syntax is about as clear as mud for doing the overall F test.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-15-2016 01:16 PM

**I've had the best luck by creating dummy variables for my categorical variables and using those instead, or keeping that in mind with looking at the parameter estimates and covariance matrix data sets that have been outputted. If you don't use dummy variables from the beginning, then you may need to rename the Effect variable using a combination of the categorical variable name and its various levels of values names. Order of the variable levels are important also. Make sure the rows correspond to the columns of your new covb that you may have to create. I have had to even rename the Col1 and etc... to instead "Black" and etc..., as an example, and then I was able to get the Test statement to work. For example, Test Black=Asian=AmIndian=0/Mult where White was the reference group. I tried the classvar=Full and was able to confirm my results using dummy variables, but then the Test statement wouldn't work for me with that approach.**

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-31-2013 01:02 PM

Dear All,

I was looking at your thread, in order to fix a similar issue I have while fitting GEE (proc genmod) via multiple imputation..mostly towards the end here I want to combine my results..I tried the solutions mentioned in the thread above but I keep getting error that "Variable GENDER is not in the PARMS= data set." although it is very well there.

Below is my code:

**proc mianalyze parms(classvar=full)=gmparms covb(effectvar=rowcol)=gmcovb edf=218;**

**class GENDER grage gr_revenu2 SM02 CARDIAC_RELATED_COND PHYSICIAN NAM PATIENT NEUROTIC_DISORDER;**

**modeleffects GENDER grage gr_revenu2 SM02 CARDIAC_RELATED_COND NEUROTIC_DISORDER **

**centred_AC centred_AQ centred_BM centred_SE ;**

**run;**

I would appreciate any help.

Thanks

Tasneem