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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 438 views
  • 1 like
  • 3 in conversation