Hi
I was wondering if anyone can advise me on the following problem:
My dataset:
time identifier: "t"
country identifier: "j"
panel identifier: "i"
x is covariate
a: refer to the number of observations available on x for all firms from country j at time t, obtained by the following command
E.g., how many observations on x are available for all firms from the US (being country j) in 2009 (being time t)
Required:
As for w, it is calculated manually, and it refers to how many observations on x are lower than the value of x for firm i using all firms from the same country for the same period.
E.g., How many observations on x in the US (j) are lower than x value for firm ABC using all observations on US companies for 2002?
And I would like to have the same for s, another variable that refers to how many observations on x are equal to the value of x for firm i using all firms from the same country for the same period.
I was wondering what Stata procdure I can use to obtain these variables?
Conclusion: by obtaining these variables, I would be able to calculate percentile scores for firms grouped by country-period combinations; that is, the scores are compared to each other only within a specific country and time period.
percentile score = [w + (s/2)]/a
Similar, not identical alternatives
xtine programme uses the same formula but unfortunately does not allow for using the grouping restriction (country-year)
The closest I got to what I need is using
Which ranks x using my requested grouping and gives the sum of same and worst scores (denoted by sw) where ties are assigned averaged ranks, but the formula I need to use is based on (s/2), which solves for any ties (I'm restricted to using this formula).
Your advice in this regard is highly appreciated
Many thanks
Mohammed
I was wondering if anyone can advise me on the following problem:
My dataset:
Code:
input int t byte(j i x a w) 2000 1 1 19 2 0 2001 1 1 60 2 1 2002 1 1 70 2 1 2000 1 2 22 2 1 2001 1 2 33 2 0 2002 1 2 44 2 0 2000 2 3 23 3 0 2001 2 3 53 3 0 2002 2 3 56 2 0 2000 2 4 90 3 2 2001 2 4 81 3 1 2002 2 4 85 2 1 2000 2 5 88 3 1 2001 2 5 92 3 2 2002 2 5 . . . end
country identifier: "j"
panel identifier: "i"
x is covariate
a: refer to the number of observations available on x for all firms from country j at time t, obtained by the following command
Code:
by j t: egen a = count(x) if !missing(x)
Required:
As for w, it is calculated manually, and it refers to how many observations on x are lower than the value of x for firm i using all firms from the same country for the same period.
E.g., How many observations on x in the US (j) are lower than x value for firm ABC using all observations on US companies for 2002?
And I would like to have the same for s, another variable that refers to how many observations on x are equal to the value of x for firm i using all firms from the same country for the same period.
I was wondering what Stata procdure I can use to obtain these variables?
Conclusion: by obtaining these variables, I would be able to calculate percentile scores for firms grouped by country-period combinations; that is, the scores are compared to each other only within a specific country and time period.
percentile score = [w + (s/2)]/a
Similar, not identical alternatives
xtine programme uses the same formula but unfortunately does not allow for using the grouping restriction (country-year)
The closest I got to what I need is using
Code:
by j t, sort : egen float sw = rank(x)
Your advice in this regard is highly appreciated
Many thanks
Mohammed
Comment