Dear All:
The data contains the following variables:
x1 = mother age
x2 = father age
x3 = (yes, no) = (1,2)
x4 = (yes, no) = (1,2)
x5 = (yes, no) = (1,2)
x6 = (yes, no) = (1,2)
x7 = stratum
x8 = weight
this is part of the data
===============
x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 |
38.8466 | 1 | 1 | 1 | 1 | 2 | 16.61921705 | |
22.9233 | 25 | 1 | 2 | 2 | 16.61921705 | ||
35.4849 | 34 | 2 | 1 | 2 | 2 | 2 | 14.51497509 |
18.9863 | 19 | 1 | 1 | 2 | 2 | 2 | 20.88637405 |
27.9425 | 23 | 2 | 1 | 2 | 2 | 2 | 16.61921705 |
23.0904 | 25 | 1 | 1 | 2 | 2 | 2 | 20.88637405 |
26.0055 | 34 | 2 | 2 | 2 | 2 | 1 | 1.56167161 |
28.6411 | 38 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
38.4986 | 42 | 1 | 2 | 2 | 2 | 2 | 16.61921705 |
31.1288 | 32 | 2 | 2 | 2 | 2 | 1 | 1.56167161 |
36.9534 | 36 | 2 | 2 | 2 | 2 | 2 | 14.51497509 |
22.1425 | 40 | 2 | 2 | 2 | 2 | 2 | 16.61921705 |
29.7890 | 32 | 2 | 2 | 2 | 2 | 2 | 14.51497509 |
28.6904 | 30 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
20.0877 | 32 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
31.6192 | 30 | 2 | 2 | 2 | 2 | 1 | 1.56167161 |
23.9836 | 24 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
18.6110 | 26 | 1 | 1 | 2 | 2 | 2 | 20.88637405 |
26.5151 | 28 | 1 | 1 | 2 | 2 | 1 | 2.09612124 |
29.2630 | 29 | 2 | 1 | 1 | 2 | 1 | 1.56167161 |
19.6630 | 19 | 2 | 2 | 2 | 1 | 2 | 16.61921705 |
17.4466 | 17 | 1 | 2 | 1 | 2.09612124 | ||
35.3342 | 41 | 2 | 2 | 2 | 2 | 2 | 14.51497509 |
29.6466 | 22 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
21.1890 | 30 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
25.4055 | 40 | 1 | 1 | 2 | 2 | 2 | 16.61921705 |
19.0164 | 18 | 1 | 2 | 2 | 16.61921705 | ||
38.4877 | 32 | 2 | 2 | 1 | 2.09612124 | ||
31.0630 | 32 | 2 | 2 | 2 | 2 | 2 | 14.51497509 |
22.5616 | 24 | 2 | 2 | 2 | 2 | 1 | 1.56167161 |
26.3178 | 36 | 2 | 2 | 2 | 2 | 2 | 14.51497509 |
21.6959 | 20 | 2 | 2 | 2 | 2 | 1 | 2.09612124 |
23.7479 | 23 | 2 | 2 | 2 | 1 | 2 | 16.61921705 |
19.2658 | 23 | 1 | 1 | 2 | 2 | 1 | 2.09612124 |
I need help with two things:
(1) compare the means of the variables X1 and X2 (continuous variables) in Proc Surveymean.
case 1: independent data
case 2: paired (matched) data.
(2) Compare the proportions of ones in the two variables X3 and X4 in Proc Surveyfreq.
(3) Similar to (2) compare the proportions of ones in the two variables X5 and X6 in Proc Surveyfreq. Once I know how to do (2), I will be able to do (3)
thank you very much in advance
steven
email: sstoline@gmail.com
To compare means under model assumptions, you'll need to use PROC SURVEYREG. If you are interested in the raw means, then Example 92.2 in the SURVEYMEANS documentation should cover what you are looking for under (1). For (2), I think you will have to create another variable that indicates pair membership, and use SURVEYREG with it as a CLASS variable.
The latter questions depend on what you are trying to do. If it is just a matter of the proportion of ones in X3 and X4 separately, then Example 90.1 in the SURVEYFREQ documentation is what is needed. However, if you want the proportion of ones in X3 and X4 combined, you will probably have to restructure your dataset to combine the variables.
https://communities.sas.com/message/176385 has the same answer.
Steve Denham
Dear Steve:
Example 92.2 does not show any hypothesis testing about means of two variables. I am not sure if I should use some options in proc syrveymeans to compare means of two variables.
In Example 90.1 SURVEYFREQ shall I create a new variable say indicator (indicator =1 for variable X3 and indicator = 2 for X4) and combine X3 and X4 in one variable say X34. Then use Table X34*indicator. Not sure.
many thanks
Steven
You're absolutely right about 92.2 not doing any testing. To get that, you'll have to go to SURVEYREG.
For the combined (and I still want to know what it means to combine the two), I think you are going to have to convert from 'wide' format to 'long' format for your data. Something like:
data want;
set have;
indicator='X3';x34=x3;output;
indicator='X4';x34=x4;output;
run;
Then fit the table statement as what you proposed. I would reorder the statement to: table indicator*x34;
Good luck.
Steve Denham
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.