Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65570

Deciles of variable from entire dataset based on breakpoints of variable from part of the dataset

$
0
0
Dear community,


my name is Batuhan and I am new to stata. I have one problem that I am dealing with for a long time now and could not resolve yet. I hope you can help me.

I have monthly stock return data from NYSE, NASDAQ and AMEX (stock exchanges). Based on my data, I have calculated the Momentum (MOM) and now I need to categorize my MOM data in deciles based on NYSE breakpoints. The MOM deciles need to be refreshed monthly.

That means that first, I have to compute the MOM deciles and the breakpoints based only on my data from the NYSE. I have to used the calculated breakpoints in order to compute my MOM deciles for the entire database (not only the NYSE).

My problem is that I need to refresh my MOM deciles monthly. What I tried to do is:

I have computed the MOM deciles for my NYSE data only for each month. --> egen NYSE_decile = xtile(cumul), by(month_id) nq(10)
My problem is that I need the breakpoints (not the deciles: 1,2,3...,9,10) which I need to use in order to compute my MOM deciles for the entire database. --> egen MOM_Decile = xtile(cumul), by(month_id) nq (10) cutpoints(NYSE_decile).
I know that, in order to get the breakpoints, I need to use pctile not xtile. But when I use egen NYSE_decile = pctile(cumul), by(month_id) nq(10) genp(percent), I am told that nq() & genp() not allowed.

To sum it up, what could I do in order to compute my MOM deciles for the whole dataset (AMEX, NYSE, NASDAQ stocks) based on the NYSE-breakpoints?

It would be a huge help if you could help me out.


Best,

Batuhan

Viewing all articles
Browse latest Browse all 65570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>