BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Arthur2
Calcite | Level 5

Hi,

I'm using the following code.

ods graphics on;
ods output lsmeans=estimate
diffs=diff;

proc mixed data = mydata (where=(treatn in (1,2,3))) plots=all;
by estremn estrem atypen atype paramcd param avisitn avisit ;
class treatn;
model aval = treatn base/residual outp=resid;
lsmeans treatn / pdiff=control('3');
run;
ods output close;
ods graphics off;

The aim is to get the LS means, SE and the difference of LS means and SEs from plcebo(treatn=3) to each of the treatments (treatn=1,2) as 'placebo - treatment. I believe currently the code is generating the diffrence other way round as (treatment - placebo).
Need to know how to reverse the direction of difference to get the difference.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

From the top of my head:

 

1) Change the sign of variable aval (this will also change the sign of residuals),

or

2) Change the sign of LS means and confidence interval limits (if any) in lsmeans and diffs datasets.

 

Make sure you label those differences appropriately in your result tables, since you are going against standard practice.

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

From the top of my head:

 

1) Change the sign of variable aval (this will also change the sign of residuals),

or

2) Change the sign of LS means and confidence interval limits (if any) in lsmeans and diffs datasets.

 

Make sure you label those differences appropriately in your result tables, since you are going against standard practice.

PG
SteveDenham
Jade | Level 19

Use an LSMESTIMATE statement that utilizes the coefficients in the direction of interest.  For example,

 

lsmestimate treatn 'Placebo - trt 1' -1 0 1,
                  'Placebo - trt 2' 0 -1 1;

    

 

 

SteveDenham

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 2 replies
  • 549 views
  • 1 like
  • 3 in conversation