Hi All,
New to the forum. Hope this is the appropriate place/means to ask this question. I'm relatively new to SAS and have hit a wall trying to figure out an analysis. I have a large dataset, but for the purposes of this question, its fairly straightforward. I have four repeated measurements on the same patient at the same time with different devices. Think, measuring someone's weight on 4 different scales. Each of the four weights is in its own column. I'm trying to perform an anova to compare the groups, but I haven't been able to get the syntax right.
Any help would be appreciated.
Example of data for explanation purposes:
Patient Number Scale 1 Scale 2 Scale 3 Scale 4
1 100 105 103 98
2 105 105 107 115
3 83 82 83 87
....
When you do an ANOVA, you need to decide on a model to fit, and you haven't specifically told us what model you want to fit. So, we should not have to read between the lines and guess, as I am about to do, and maybe guess wrong, but really @EMCCMDoc, tell us what model you want to fit. (And by the way, your statement that it is like repeated measures with 4 different scales doesn't mean anything here, you can't have repeated measures with different scales, and so I am guessing you didn't really mean you want a repeated measures analysis, and neither I nor Reeza have provided code for a repeated measures analysis).
So, I'm guessing you want the equivalent of a paired T-test, but with 4 groups instead of the two that are normally in a paired t-test. Thus:
data have;
input PatientNumber Scale1 Scale2 Scale3 Scale4;
cards;
1 100 105 103 98
2 105 105 107 115
3 83 82 83 87
;
proc transpose data=have out=long;
by patientnumber;
var scale1-scale4;
run;
proc glm data=long;
class patientnumber _name_;
model col1=patientnumber _name_;
run;
And don't use PROC ANOVA here unless your entire data set has no missing values.
I see you have marked another answer as incorrect, and I respectfully disagree.
Your experimental design is EITHER a repeated measures (although I explained why it probably is not, or your explanation is flawed), or it is the ANOVA equivalent of a paired t-test with 4 groups, and the the answer marked correct is not the right analysis for either of those designs.
I concur with @PaigeMiller by the way, if your experimental design is repeated measures across the same individual my solution isn't correct. I answer the question asked, but this isn't the correct analysis for your experimental design, which I did not factor in.
Whether or not that’s statistically appropriate, feel free to comment.
Already commented. It's not appropriate.
I’m looking for the equivalent of a paired t-test, but for four groups. I was under the impression that an anova was the appropriate test.
A plain old ANOVA, like the one you marked correct, is the equivalent of an un-paired t-test. The code I provided is the ANOVA version of a paired t-test.
As far as missing data, there are two missing data points for one of the four scales, but the other three are complete.
Do not use PROC ANOVA, use PROC GLM.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.