turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- How to calculate the sample size?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted
# How to calculate the sample size?

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

/* Population size: 29.477.792

/* Parametros:

N P Q P*Q Z_95% Z2_95% E_ 5% E2_5%

29477792 0,5 0,5 0,25 1,9600 3,8416 0,05 0,0025

/* Formula : n = N*(p*q)*Z2 / (p*q)*Z2 + (N-1)*E2 */

How can I do a program to calculate the sample size, according to this formula ???

Accepted Solutions

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lady_Lucy

3 weeks ago

data want; n=29477792; p= 0.5; q= 0.5; pq = p*q; z_95 = 1.96; z2_95 = 3.8416; e_5 = .05; e2_5 = 0.0025; nwant = n*pq*z2_95/pq*z2_95 +(n-1)*e2_5; run;

But I think you need to verify your "formula".

Note I use . instead of , as that is the NLS setting for my system. You should be able to reverse things easy enough.

All Replies

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lady_Lucy

3 weeks ago

data want; n=29477792; p= 0.5; q= 0.5; pq = p*q; z_95 = 1.96; z2_95 = 3.8416; e_5 = .05; e2_5 = 0.0025; nwant = n*pq*z2_95/pq*z2_95 +(n-1)*e2_5; run;

But I think you need to verify your "formula".

Note I use . instead of , as that is the NLS setting for my system. You should be able to reverse things easy enough.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ballardw

3 weeks ago

Hi, Thank you so much!

It's worked.

data want;

n=10000;

p=0.5;

q=0.5;

pq = p*q;

z_95 = 1.96;

z2_95 = 3.8416;

e_5 = 0.05;

e2_5 = 0.0025;

nwant = (n*pq*z2_95) / ((pq*z2_95) + ((n-1)*e2_5));

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lady_Lucy

3 weeks ago

Yea I agree I think you need to verify your formula. I think what you are trying to do is:

n = N*X / (X + N – 1),

where,

X = Z(α/2)^2 *p*(1-p) / MOE^2,

and Zα/2 is the critical value of the Normal distribution at α/2 (e.g. for a confidence level of 95%, α is 0.05 and the critical value is 1.96), MOE is the margin of error, p is the sample proportion, and N is the population size. Note that a Finite Population Correction has been applied to the sample size formula.

I think it would look something like this

n=(N*((Z^2 *p*(1-p)) / MOE^2)) / (((Z^2 *p*(1-p)) / MOE^2)+N+1)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tommy1

3 weeks ago

Thank you. Thank you.

You really helped me.

you're so right. that's the 'exact format' of formula.

before,I guess that I didn't express right.

sorry about my english