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
- /
- Base SAS Programming
- /
- what that code does mean?

Topic Options

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

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

03-27-2016 12:49 PM - last edited on 03-27-2016 02:02 PM by Reeza

```
DATA covprob;
p = .5;
q = 1-p;
z=abs(probit(.025));
zz=z*z;
do n = 10 to 500;
w = zz / (2 * n);
rad = sqrt(2*w*p*q + w*w);
rt = (p + w + rad)/(1 +2*w);
lt = (p + w - rad)/(1 +2*w);
nhat_rt = floor(n*rt);
nhat_lt = ceil(n*lt - 1);
ncurl_rt = floor((n+4)*rt - 2);
ncurl_lt = ceil((n+4)*lt - 3);
p1 = probbnml(p, n, nhat_lt);
p2 = probbnml(p, n, nhat_rt);
cv_hat = p2 - p1;
p3 = probbnml(p, n, ncurl_lt);
p4 = probbnml(p, n, ncurl_rt);
cv_curl = p4 - p3;
output;
end;
keep n cv_hat cv_curl;
run;
PROC plot data = covprob;
plot cv_hat*n = '^';
plot cv_curl*n = '~';
run;
quit;
```

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

Posted in reply to bigban777

03-27-2016 02:04 PM

In what context? Is there a specific part you don't understand?

Are you looking for an explanation of a specific line?

Where did you find this code and what are you trying to do with it?

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

Posted in reply to bigban777

03-27-2016 03:31 PM

It looks like some sort of power analysis for (binomial) proportions. But why reverse engineer this undocumented code? Understand the problem and write your own. And document it!

PG

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

Posted in reply to PGStats

03-27-2016 05:18 PM

If it is power analysis it's likely proc power would likely be a better implementation as well

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

Posted in reply to bigban777

03-27-2016 05:34 PM

That part:

nhat_rt = floor(n*rt);

nhat_lt = ceil(n*lt - 1);

ncurl_rt = floor((n+4)*rt - 2);

ncurl_lt = ceil((n+4)*lt - 3);

Is it interval? Why it is subtracte -1, -3

nhat_rt = floor(n*rt);

nhat_lt = ceil(n*lt - 1);

ncurl_rt = floor((n+4)*rt - 2);

ncurl_lt = ceil((n+4)*lt - 3);

Is it interval? Why it is subtracte -1, -3