**Introduction**

You might already be aware of an** independent samples t-test** or a

**matched-pairs**as approaches to comparing the means of continuous variables. In this post, we’ll show you how to compare proportions, rather than means, using Stata’s prtest command.

*t*-test**Create Data**

Let’s say you want to compare consumer preferences for two products, A and B. You ask 310 people if they would definitely buy A, and you ask the same number of people if they would definitely buy B. Let’s create these data first.

set obs 310

gen a = 0

replace a = 1 in 1/112

gen b = 0

replace b = 1 in 1/86

label define definitely 0 "No" 1 "Yes"

label value a b definitely

**Run the Test**

Now try:

prtest a == b

Here’s what you get:

So you see that the proportion of definite intention to buy product a (36.13%) is significantly greater than the proportion of definite intention to buy product b(27.74%), *z* = 2.24, *p *= .0126.

If you had a two-tailed hypothesis, you could observe that the proportion of definite intention to buy product a (36.13%) is significantly different from the proportion of definite intention to buy product b(27.74%), *z* = 2.24, *p *= .0251.

BridgeText can help you with all of your **statistical analysis needs**.