Programming the statistical procedures from SAS

Using proc compare to compare means between 2 variables?

Reply
Occasional Contributor
Posts: 14

Using proc compare to compare means between 2 variables?

Hello.

I have two surveys (asking the same question) which are combined into one single dataset (table below)

What I'm interested in is testing whether the means in survey 1 is the same as the means in survey 2 (in this case is the mean of 6,8 in survey 1 statistical different from 6,2 in survey 2).

I had been thinking of using proc compare in this ways:

proc compare base=test allstats briefsummary;

var survey_1; with survey_2;

run;

but I had been unsure whether the procedure actually will test the 2 means against each other using the std.dev. in both surveys or is the procedure actually doing a multiple testing of whether

5 = [empty],

7 = 7

[empty] = 7

etc.

Data: Test

IDSurvey_1 (avg=6,8)Survey_2 (avg 6,2)
15
277
37
48
596
658
73

Really appreciate any kind of help

/Dan

Trusted Advisor
Posts: 1,659

Re: Using proc compare to compare means between 2 variables?

As far as I know, PROC COMPARE doesn't actually compare the means to each other using a standard statistical test. PROC TTEST is what you want to use.

Trusted Advisor
Posts: 2,114

Re: Using proc compare to compare means between 2 variables?

Dan,

A paired T-test or PROC Univariate (on the difference score) are the tests that are appropriate here.  Of note, your example has less than half the observation with complete data (assuming the ID variable is unique to the person level).  Both of those tests will exclude the subjects who just took the test once.  That much missing data is causes me concern about generalizability.

PROC COMPARE is for comparing the raw data between two datasets.

Doc Muhlbaier

Duke

Occasional Contributor
Posts: 14

Re: Using proc compare to compare means between 2 variables?

Thanks for the answers for far.

Isn't TTEST only appropriare for samples around 30 observations or less (small sample)?

In my actual dataset, I have around 4000 observations in total (3500 for survey 1 and 3000 for survey 2). Couldn't this be a problem testing the means using TTEST?

/Dan

Respected Advisor
Posts: 2,655

Re: Using proc compare to compare means between 2 variables?

TTEST is certainly appropriate, no matter the sample size, for this sort of comparison.  However, check what Doc said--if you have a lot of unpaired results (only one test for a subject), the generalizability is going to be limited to those that have complete records, and those subjects may very well not be representative of your full sample or the population you want to infer the results for.

Steve Denham

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