Dear Statalisters,
I saw someone using
bysort xvar : gen x_Q3=ceil(_n/(_N/3))
to split sample into 3 buckets.
input gvkey xvar
1002 4
1003 67
1001 29
1004 34
1001 10
1002 6
1003 54
1003 23
1004 43
1003 4
1002 67
1001 5
1001 3
1002 7
end
below is pretend data, somehow I did not get any where close to 3 buckets.
I was just curious if I misunderstood how the other person used it without fail.
thank you,
Rochelle
I saw someone using
bysort xvar : gen x_Q3=ceil(_n/(_N/3))
to split sample into 3 buckets.
input gvkey xvar
1002 4
1003 67
1001 29
1004 34
1001 10
1002 6
1003 54
1003 23
1004 43
1003 4
1002 67
1001 5
1001 3
1002 7
end
below is pretend data, somehow I did not get any where close to 3 buckets.
I was just curious if I misunderstood how the other person used it without fail.
thank you,
Rochelle
Comment