Programming the statistical procedures from SAS

compare averages and prpoprtions in Proc surveymeans and Proc surveyfreq

Reply
Contributor
Posts: 32

compare averages and prpoprtions in Proc surveymeans and Proc surveyfreq

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

Respected Advisor
Posts: 2,655

Re: compare averages and prpoprtions in Proc surveymeans and Proc surveyfreq

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

Contributor
Posts: 32

Re: compare averages and prpoprtions in Proc surveymeans and Proc surveyfreq

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

Respected Advisor
Posts: 2,655

Re: compare averages and prpoprtions in Proc surveymeans and Proc surveyfreq

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

Ask a Question
Discussion stats
  • 3 replies
  • 168 views
  • 0 likes
  • 2 in conversation