How to divide two variables and compare the mean of different groups?

Reply
New Contributor
Posts: 3

How to divide two variables and compare the mean of different groups?

[ Edited ]

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.

 

16.573.14
16.773.09
16.713.14
220.279.37
220.2710.20
221.8210.14
2.10.44
2.9.83
2.9.69
2.9.37
321.3510.71
321.3410.74
321.6310.79
413.406.77
413.106.86
413.876.99
517.298.81
516.838.92
517.268.83
Regular Contributor
Posts: 162

Re: How to divide two variables (with replications) and compare the means?

Please post the expected output and post the data you have as data-step.

Proc summary can create mean-values for each group.
New Contributor
Posts: 3

Re: How to divide two variables (with replications) and compare the means?

[ Edited ]
Posted in reply to error_prone

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;
Regular Contributor
Posts: 162

Re: How to divide two variables (with replications) and compare the means?

Never used proc glm, but maybe removing the class statement solves the problem. 

New Contributor
Posts: 3

Re: How to divide two variables (with replications) and compare the means?

Posted in reply to error_prone

No, it did not help.

Ask a Question
Discussion stats
  • 4 replies
  • 176 views
  • 0 likes
  • 2 in conversation