Hello, I have a programming problem that has me stumped, and it's a bit embarrassing because in theory it seems so simple.
I have a data set of mouse activity in a behavior test. There are multiple types of mice, that received one of four combinations of treatments.
I've been able to compare the mice according to their type and treatment with code like this:
proc sort; by treat;
proc glm; by treat;
model s1-s3 = line / nouni;
means line / tukey;
In this example, I can compare my mouse strains ("line") within each treatment condition ("treat"), in each stage of a 3-stage test ("s1-s3"). For example, I could say that mouse line B spent more time in some particular zone than mouse line A in stage 2.
This is all well and good, but I would also like to be able to compare between stages. In other words, I need to see if there are any significant changes in performance from stage 1 to stage 2 to stage 3 within each line and/or treatment condition.
For example, did mouse line A show a significant difference in time spent in some particular zone between stage 1 and 2? What about between stage 2 and 3? These are the questions I need to answer. I've exhausted my creativity trying to rewrite my code to generate these stage comparisons, but it's a nut I can't seem to crack.
If anyone could offer some insight or some useful resources, it be very helpful!
First, I don't really understand the experiment. BUT if you have 3 different outcome measure variables like S1, S2 and S3 that you think should be treated then perhaps you want to reshape the data so that you have a variable to indicate the stage and a single "measure" value.
So if your current data looks like
Mouse line S1 S2 S3
A 1 15 14 14.5 (obviously very made up numbers)
Then reshape to
Mouse Line Stage Measure
A 1 S1 15
A 1 S2 14
A 1 S3 14.5
Which would be a task for Proc transpose something like:
Proc transpose data=have out=trans
by mouse line;
var s1 s2 s3;
The behavior of simple transpose code would add a variable _name_ with the value S1 S2 S3, the name of the original variable. Options would allow renaming it to Stage to make more sense.
Obviously your data and code would also include your Treat variable (and possibly others).
1) change the data set name to the transposed set
2) add Stage (or _name_ or whatever) to the Class statement.
3) change the model statement to use Measure (or which name you get in the transposed data) as the dependent and add Stage (or whatever) to the independent side.
LSMEANS, Estimate and Contrast statements let you build "questions" about combinations of the variables in the model.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.