Hi i have data with two variables one is score and other is binary variable "label".
score label
245 1
261 0
250 1
300 1
270 0
I am interested to find counts of 1 in label variable for the given manual bins. I have written code but it is giving only frequency of squares in the bins as.
proc iml;
use work.prtf_data;
read all var {Score} into x;
close work.prtf_data;
cutpts = {.M 261 273 283 291 298 305 312 330 341 342 .I};
r = bin(x, cutpts);
call tabulate(BinNumber, Freq, r);
lbls = {"< 261" "262-273" "274-283" "284-291" "292-298" "299-305" "306-312" "313-330" "331-341" "> 342"};
print Freq[colname=lbls];
i want my results as
"score" "" 1 freq"
<261 2
262-273 0
.....
....
Please suggest me any solution. Thanks