Hello.
The following is the data that I want to analyze. The variables are Group, A and B. Basically, I want to find the mean of A and B in each group, divide A_mean by B_mean (= y), and compare the value of y between the groups (by Tukey for example). A and B are measured three times in all groups, except for B in Group 2. A and B are also independent. How should I write my SAS code?
Thank you.
1 | 6.57 | 3.14 |
1 | 6.77 | 3.09 |
1 | 6.71 | 3.14 |
2 | 20.27 | 9.37 |
2 | 20.27 | 10.20 |
2 | 21.82 | 10.14 |
2 | . | 10.44 |
2 | . | 9.83 |
2 | . | 9.69 |
2 | . | 9.37 |
3 | 21.35 | 10.71 |
3 | 21.34 | 10.74 |
3 | 21.63 | 10.79 |
4 | 13.40 | 6.77 |
4 | 13.10 | 6.86 |
4 | 13.87 | 6.99 |
5 | 17.29 | 8.81 |
5 | 16.83 | 8.92 |
5 | 17.26 | 8.83 |
Here's my SAS code. The problem with this code is that after dividing A_Mean by B_Mean, a single value of y for each group is obtained. As a result, I am not able to compare and test the significance of the the y's.
data data;
input Group A B;
datalines;
1 6.57 3.14
1 6.77 3.09
1 6.71 3.14
2 20.27 9.37
2 20.27 10.20
2 21.82 10.14
2 . 10.44
2 . 9.83
2 . 9.69
2 . 9.37
3 21.35 10.71
3 21.34 10.74
3 21.63 10.79
4 13.40 6.77
4 13.10 6.86
4 13.87 6.99
5 17.29 8.81
5 16.83 8.92
5 17.26 8.83
;
proc print;
run;
proc means;
class Group;
var A B;
output out=out mean= / autoname;
run;
proc print data=out;
run;
data new;
set out;
y=divide(A_Mean, B_Mean);
run;
proc print;
run;
proc glm data=new;
class Group;
model y=Group;
run;
Never used proc glm, but maybe removing the class statement solves the problem.
No, it did not help.
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.
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.