I have an unbalanced panel data of stocks.
permno: uniquely identify each stock
yrm: date variable, such as 1998m1,1998m2,...
x: some stock characteristics, e.g. market capitalization
excd: exchange code, this stock is NYSE stock, or non-NYSE stock (NYSE: New York Stock Exchange)
shcd: share code, such as 10,11,12,14,18,30,31,32....
What I want to do is to get : for each month, get each stock's x's percentile in the distribution of all NYSE stocks with share codes of 10 or 11.
need to get a variable called xpt, which contains a stock's x rank percentile, say if for one stock, in 1998m1, its x percentile is 0.7 if it is the 70th percentile of x distribution of all NYSE stocks with share codes of 10 or 11.
Can you help me with generating this variable?
Thanks a lot!
permno: uniquely identify each stock
yrm: date variable, such as 1998m1,1998m2,...
x: some stock characteristics, e.g. market capitalization
excd: exchange code, this stock is NYSE stock, or non-NYSE stock (NYSE: New York Stock Exchange)
shcd: share code, such as 10,11,12,14,18,30,31,32....
What I want to do is to get : for each month, get each stock's x's percentile in the distribution of all NYSE stocks with share codes of 10 or 11.
need to get a variable called xpt, which contains a stock's x rank percentile, say if for one stock, in 1998m1, its x percentile is 0.7 if it is the 70th percentile of x distribution of all NYSE stocks with share codes of 10 or 11.
Can you help me with generating this variable?
Thanks a lot!
Comment