hello teacher
I have a question need help, I want to simulate the SAS code to separate "size" to two groups per year (yymm is time variable)

///////(SAS code)///////
PROC RANK DATA=stock GROUPS=2 OUT=rout1;
VAR size;
RANKS sr;
BY yymm;
RUN;
////////////////////////////////////
My Stata code
bys yymm: xtile sr=size,np(2)

Stata reply: (xtile may not be combined with by )


so I change code
xtile sr=size,nq(2) by(yymm)

Stata reply: (option by() not allowed )

so.. what can I do? , please help