I have data like below:
2 group
30 measure
site measure group c1
1 1 1 67
1 1 1 74
1 2 1 44
1 2 1 32
1 3 1 124
1 3 1 137
1 4 1 58
1 4 1 55
…………….
22290 27 2 18
22290 27 2 79
after summary :
proc means data=data1 noprint nway;
class group measure;
var c1;
output out=Ave_rates mean=mean; run;
measure group mean
1 1 63
1 2 70
2 1 67
2 2 68
3 1 75
3 2 86
……..
30 1 33
30 2 50
I want to use proc ttest to tests of significance between two group for each measure,
I think I may need write a do loop or macro for ttest, or I need use ttest 30 times. someone help me!
Thank you!
I am guessing that you are looking for something like this:
proc sort data=data1; by measure; run; proc ttest data=data1; by measure; class group; var c1; run;
BY group processing, using each value of a variable to perform similar operations, is a core concept in SAS programming.
You should be able to use PROC TTEST with a BY MEASURE; statement (which then requires you to sort the data by the MEASURE variable first). You don't need PROC MEANS, you don't need macros, you don't need DO loops.
It is very confusing that you have 30 groups after PROC MEANS but 27 groups before PROC MEANS. Can you explain that?
I am guessing that you are looking for something like this:
proc sort data=data1; by measure; run; proc ttest data=data1; by measure; class group; var c1; run;
BY group processing, using each value of a variable to perform similar operations, is a core concept in SAS programming.
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.