Hello,
I have a panel dataset that looks like:
Id date x
I have multiple id's, and for each ID I have observations on a numeric X variable at different dates. The dates are not sequential (i.e., there are gaps between two dates) , and not always the same for all ID's.
I want to create a new variable that tells me what fraction of previous X values for the given ID are less than the current X. So basically, when the data is sorted by ID date, I want to know what fraction of X's are less than the current value of X for the specific ID.
Thank you,
Costas
I have a panel dataset that looks like:
Id date x
I have multiple id's, and for each ID I have observations on a numeric X variable at different dates. The dates are not sequential (i.e., there are gaps between two dates) , and not always the same for all ID's.
I want to create a new variable that tells me what fraction of previous X values for the given ID are less than the current X. So basically, when the data is sorted by ID date, I want to know what fraction of X's are less than the current value of X for the specific ID.
Thank you,
Costas
Comment