| Date: | Wed, 6 Jul 2011 13:31:43 -0500 |
| Reply-To: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Subject: | Re: proc freq with exact test |
|
| In-Reply-To: | <CAHRqbezAw_v8P=C9mba92fpWdYGqNeLMgaKptafL+BjO=O6G=w@mail.gmail.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
I think you want something like this...
data fish;
input id $ var1 var2;
retain tot1 20 tot2 23;
array v[*] var:;
array t[*] tot:;
do trt = 1,2;
resp=1;
do weight = v[trt],t[trt]-v[trt];
output;
resp=0;
end;
end;
*drop var: tot:;
cards;
row1 16 17
row2 19 20
;;;;
run;
proc print;
run;
proc freq;
by id;
tables trt*resp / exact;
weight weight;
run;
On Wed, Jul 6, 2011 at 1:09 PM, vivian v <v.vivian3@gmail.com> wrote:
> Hi,
> I have a question about proc freq.
> For general dataset like the following:
> sex group
> person1 1 1
> person2 0 1
> ......
>
> Then we can use proc freq to perform an exact test with exact option. If my
> dataset is like the following:
>
> var1 var2
> row1 16 17
> row2 19 20
> ........................100 rows.........
>
> And total number for var1 is 20, total number for var2 is 23. I want to
> perform exact test on each row. For example, for row1, 16 out of 20 VS. 17
> out of 23, and I need to obtain 100 p-values. How can I write the code in
> SAS? Thanks a lot!
>
|