Programming the statistical procedures from SAS

Issue with Proc Mixed..

Reply
Contributor
Posts: 44

Issue with Proc Mixed..

Hi All,

i am facing a small issue while using proc mixed please any one can help me out from this..

treatment groups : trt1, trt2, trt3, placebo = total 4 treatments

visits: day1, day 5, day10, day15, day20, day25, day30,= total 7 visits

Ex: Template or shell

                                                                                                 Table tiltel - Eff1

Model - adjusted Treatment difference                           covariate                                        Estimate                                   95% CI

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Trt 1 Vs placebo                                                                Age Group                                    

                                                                                              <80                                            XX.XX                                            XX.X, XX.X

                                                                                               >=80                                         XX.XX                                            XX.X, XX.X

Trt 2 Vs placebo                                                                Age Group                                    

                                                                                              <80                                            XX.XX                                            XX.X, XX.X

                                                                                               >=80                                         XX.XX                                            XX.X, XX.X

Trt 3 Vs placebo                                                                Age Group                                    

                                                                                              <80                                            XXX.XX                                          XX.X, XX.X

                                                                                               >=80                                         XX.XX                                            XX.X, XX.X

Note: Repeat the same shell for rest of the parameters.

i used code for this shell Eff1

proc mixed data=dataset;

     class subj trt covariate visit;

     model chg= baselinevalue trt visit covariate trt*visit trt*covariate covariate*visit trt*visit*covariate/ddfm=kr cl;

     repeated avisit/type=UN sub=subj;

     lsmeans trt*visit*covariate/diff cl;

run;


My question is how to use the above code to following shell/Mock:

                                                                                                              Table 2: XXXXX (EFF_2)

Covariate                                                                                  Model-adjusted Treatment Difference                          95% CI

                                                                                                    ( Totla Treatment XXX Vs Placebo)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Age Group                          <80                                                                      XX.XX                                              XX.X, XX.X

                                          >=80                                                                      XX.XX                                              XX.X, XX.X

sex                                    Male                                                                      XX.XX                                              XX.X, XX.X

                                          Female                                                                XX.XX                                              XX.X, XX.X

.

.

.

.

Thanks in advance.

Respected Advisor
Posts: 2,655

Re: Issue with Proc Mixed..

I think this will just be a matter of adding sex and age_group to the class statement and to the model

proc mixed data=dataset;

     class subj trt sex age_grp visit;

     model chg= baselinevalue trt|visit|sex|age_grp/ddfm=kr cl; /* Use pipe notation to get all fixed effects and all interactions */

     repeated avisit/type=UN sub=subj;

     lsmeans trt*visit*sex*age_grp/diff cl;

run;

I may be misunderstanding your request however.

Steve Denham

Contributor
Posts: 44

Re: Issue with Proc Mixed..

Hi Steve,

Good Morning! thank you so much for your prompt reply!!

i try with your code but i facing small problem in output that is

my study drug has different doses : trt1(10mg), trt2(20mg), trt3(30mg) are compared with placebo.

so for first table (EFF_1) display the reults are for 10mg with placebo, 20mg with placebo, 30mg with placebo for each covariate wise.

but coming to 2nd table(EFF_2) i have to display the reuslts study treatment(overall: 10mg, 20mg, 30 mg) Vs placebo for each covariate wise.

if i used the above code then i am getting results for Eff_1 table not for Eff_2 .

please suggest i have to consider in code to get accurate output.

Best Regards,

Hima

Respected Advisor
Posts: 2,655

Re: Issue with Proc Mixed..

Add a BY statement, so that the analyses are by effectiveness endpoint.

Again, unless I am missing something, such as EFF_2 being a subset analysis.  In that case, a WHERE statement should narrow the field.

Steve Denham

Frequent Contributor
Posts: 80

Re: Issue with Proc Mixed..

Hi Hima,

I think what you are looking for is a contrast of (all active treatments) vs. placebo.  Is that correct?

I think you would want to use an Estimate statement that would allow you to build a contrast of (1 1 1 -3) / divisor = 3 for treatment, but also include code for each covariate level.  It would be a very large statement, and you'd want to keep it a single statement so that you can adjust your confidence intervals appropriately.  I think something like this might work.  I am only doing one covariate at a time, as that looks like what you intended.  If you actually want to put all the covariates in at the same time with all their interactions, this is probably going to get too complicated.

class subj trt age_grp visit;

model chg = baselinevalue trt|visit|age_grp / ddfm = kr cl;


and then either


estimate 'Any Treatment vs. Placebo for Age < 80'    trt 1 1 1 -3    trt*age_grp [1, 1 1] [1, 2 1] [1, 3 1] [-3, 4 1],

             'Any Treatment vs. Placebo for Age >= 80'   trt 1 1 1 -3    trt*age_grp [1, 1 2] [1, 2 2] [1, 3 2] [-3, 4 2]    / divisor = 3 e adjust = scheffe;


or


estimate 'Any Treatment vs. Placebo for Age < 80'    trt 1 1 1 -3    trt*age_grp 1 0 1 0 1 0 -3 0,

             'Any Treatment vs. Placebo for Age >= 80'   trt 1 1 1 -3    trt*age_grp 0 1 0 1 0 1 0 -3    / divisor = 3 e adjust = scheffe;

Unless I made an error, I think those two estimate statements are equivalent.  One uses positional syntax, and the other uses non-positional.  For age_grp, positional (the second) looks cleaner.  But realize if you have a covariate with 5 levels, that string of digits will have 20 more zeros sandwiched in there in various places.  (personally I like seeing that).  You can look up all this in the SAS help where they have a simpler example.  The option e in the statement is very important as it will output the design matrix for you.  This will let you check that you put all the 1s and 0s in the correct places for what you want.  Note, they'll be divided by the divisor.

The syntax of both are dependent on a few things: 1. the order of your class statement will change the order of your interaction terms, regardless of how you order them in the estimate statement; 2. the order of your variables sort will impact the order you need in the estimate statement.  I assumed your treatments will naturally sort 1, 2, 3, placebo.  If they don't, you'll have to mix it up.

Note: your procedure for Eff_1 does not adjust for multiple comparisons.  Some researchers don't adjust, but I think they are in the majority.  I'd double check with your head statistician.  If you need to adjust, you want to use diff = control adjust = dunnett since you are only comparing each level to a control.

Steve, does this seem right?  I don't need to add in the interaction term of all three, right, because we're summing over all the visit levels anyway?

Best,

Michael

Message was edited by: Michael Cooney (added note about Eff_1)

Respected Advisor
Posts: 2,655

Re: Issue with Proc Mixed..

Looks right to me.  Thanks for taking this one, Michael.  I missed the key element of control vs. average of all treatments.

Depending on the version of SAS/STAT, the use of the LSMESTIMATE statement might simplify this.  The 'main effect' parts can be dropped to give:

lsmestimate trt*age_grp  'Any Treatment vs. Placebo for Age < 80'   1 0 1 0 1 0 -3 0,

                                    'Any Treatment vs. Placebo for Age >= 80' 0 1 0 1 0 1 0 -3    / divisor = 3 e adjust = scheffe;

The LSMESTIMATE statement has the clear advantage of simplicity, in that it provides a linear combination of the least squares means, and consequently avoids the specification of other terms necessary to the ESTIMATE statement.

Steve Denham


Contributor
Posts: 44

Re: Issue with Proc Mixed..

Thank you so much Michael & Steve!!

i will work out on this and let you know the status...

once again thanks alot..

Hima

Ask a Question
Discussion stats
  • 6 replies
  • 585 views
  • 4 likes
  • 3 in conversation