## Code for test of proportion

Solved
Frequent Contributor
Posts: 96

# Code for test of proportion

Hello Everyone,

I have a set of firms which I divided into three categories- 1, 2, and 3- based on their special characteristics. For each category, I have some information like sales, profit, and so on. I want to test the difference in proportion for this sample. In other words, I want to test whether the total sales in Group 1 is significantly different from Group 2 and 3. The data I have is as follows:

Group sales profit

1          100     20

2          150     10

3          120     40

I would appreciate if someone shares the code that will help me do the desired analysis.

Thank you.

Accepted Solutions
Solution
‎05-03-2012 12:29 AM
Super User
Posts: 10,778

## Re: Code for test of proportion

Are you calling some statistical method ?

If you want multi-comparion , Check out proc glm + lsmeans .

Note: these all is based on Normal Data.

Ksharp

All Replies
Solution
‎05-03-2012 12:29 AM
Super User
Posts: 10,778

## Re: Code for test of proportion

Are you calling some statistical method ?

If you want multi-comparion , Check out proc glm + lsmeans .

Note: these all is based on Normal Data.

Ksharp

Posts: 2,655

## Re: Code for test of proportion

It looks like you have removed all the variability in each group by summing within the group.  With only three groups and no replication within group, an analysis of variance approach (say PROC GLM) will not work, as there are no degrees of freedom left for error--they are all used up in the numerator.

Rather than summing, what about just classifying the individual firms into groups?  Working backwards from your summary data, what if you had something like:

data one;

input firmid firmclass sales profit;

datalines;

1 1 30 10

2 1 50 30

3 1 20 -20

4 2 60 0

5 2 90 10

6 3 50 10

7 3 40 20

8 3 30 10

;

proc glm data=one;

class firmclass;

model sales profit=firmclass;

lsmeans firmclass/pdiff stderr cl;

quit;

run;

This would implement Ksharp's suggestion, and provide tests about the marginal means of sales and profits.  Unfortunately, if you are truly interested in testing for differences in the totals of these variables, you need to have some sort of replication that is not readily apparent in your summary dataset.

Steve Denham

🔒 This topic is solved and locked.