Hi all; I want to know if there is another better way to add the group number easily,when using the PROC FREQ procedure to caculate the P value.
The column A &column B in attachment is what i want to generate,the two columns are not included in the data set 'mergeorder'.
the want dataset is like this:
cate trt COUNT total A B
xxxx GL xx xx 1 1
xxxx GL xx xx 1 2
xxxx LY xx xx 2 1
xxxx LY xx xx 2 2
..............
the data set 'mergeorder'. has too many categories ,there are only two trt groups (GL &LY),each trt group has been caculated by 'total-count' .
Here is my approach ,
data fish;
set mergeorder;
IF TRT='GL'
THEN DO
A=1;
B=1;
OUTPUT;
END;
IF TRT='LY' THEN DO
A=2 ;
B=1;
OUTPUT;
END;
run;
data fish2;
set merge2;
COUNT=TOTAL-COUNT;OUTPUT;
run;
DATA FISH3;
SET FISH2;
IF TRT='GL'
THEN DO
A=1;
B=2;
OUTPUT;
END;
IF TRT='LY' THEN DO
A=2 ;
B=2;
OUTPUT;
END;
RUN;
DATA FISHER;
SET FISH FISH3;
RUN;
PROC SORT DATA=FISHER out=fishorder;
BY CATE;
RUN;
proc freq data=fishorder ;
table a*b / fisher ;
weight count/zeros;
by cate;
output out=fish_2 fisher;
run;
Thanks!