BookmarkSubscribeRSS Feed
smortaheb
Calcite | Level 5

Hello, 

 

I have a dataset which has observations before and after a treatment in 2 conditions. So I have "post" and "Pre" treatment measurements in condition "A" and "post" and "pre" treatment measurements in condition "B". I want to compare (Post - Pre) in condition A with (Post - Pre) in condition B. For that, I wrote the following code(time represents pre and post): 

 

PROC MIXED method=REML, data=my_data;

class subj_id condition time gender;

model value = time condition gender time*condition;

random int / subject=subj_id type=UN;

contrast 'my_contrast' time*condition 1 -1 -1 1;

RUN;


Because I am new to SAS, I don't know whether this code does the same thing that I want or not. Can you help me to understand it better. Thanks! 

1 REPLY 1
PaigeMiller
Diamond | Level 26

Use the E option of the contrast statement, this will tell you what is being multiplied by 1 and what is being multiplied by –1.

 

contrast 'my_contrast' time*condition 1 -1 -1 1/e;

 

--
Paige Miller

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 799 views
  • 0 likes
  • 2 in conversation