BookmarkSubscribeRSS Feed
sstoline
Calcite | Level 5

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

===============

x1x2x3x4x5x6x7x8
38.84661111216.61921705
22.92332512216.61921705
35.4849342122214.51497509
18.9863191122220.88637405
27.9425232122216.61921705
23.0904251122220.88637405
26.005534222211.56167161
28.6411381122216.61921705
38.4986421222216.61921705
31.128832222211.56167161
36.9534362222214.51497509
22.1425402222216.61921705
29.7890322222214.51497509
28.6904301122216.61921705
20.0877321122216.61921705
31.619230222211.56167161
23.9836241122216.61921705
18.6110261122220.88637405
26.515128112212.09612124
29.263029211211.56167161
19.6630192221216.61921705
17.4466171212.09612124
35.3342412222214.51497509
29.6466221122216.61921705
21.1890301122216.61921705
25.4055401122216.61921705
19.01641812216.61921705
38.4877322212.09612124
31.0630322222214.51497509
22.561624222211.56167161
26.3178362222214.51497509
21.695920222212.09612124
23.7479232221216.61921705
19.265823112212.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

3 REPLIES 3
SteveDenham
Jade | Level 19

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

sstoline
Calcite | Level 5

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

SteveDenham
Jade | Level 19

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

sas-innovate-2024.png

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.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 1371 views
  • 0 likes
  • 2 in conversation