Hello,
I am stuck trying to rank a variable conditionally.....I understand rank is an egen function, whilst cond is not
IF var alarm does not equal "0" (string) then var rank_AvgPrbAlarm is ranked as normal
IF var alarm does equal "0" the var rank_AvgPrbAlarm is returned as zero
Here is the code at the moment...
bysort raceid: egen rank_AvgPrbAlarm = rank(cond(alarm != "0" ,(-AvgPrbAlarm),track,0))
which is returning the error message 'track not found'
Any help appreciated please
Related Posts with Rank with a Condition
Multilevel logistic regression with cross-sectional data: Why Prob >= chibar2 became 1.000 after adding a level-2 variable?Hello everyone, I'm running a multilevel logistic regression with SHARE Corona Survey. I would like…
Comparison of two independent variables in multiple linear regression OLSHello All, I'm working on a research project which will seek to compare the benefits of an addition…
analytical weights and logit/mlogit/ologit modelsI noticed today that the logistic regression commands mentioned in the title to this topic included …
issues with clustering in ivreghdfe - insufficient observationsI needed some advice on clustering while using ivreghdfe. My code is - HTML Code: ivreghdfe yvar (…
Add summary statistics in a graphHey, I am plotting the graph of an event study. I want to plot in the graph some information like t…
Subscribe to:
Post Comments (Atom)
0 Response to Rank with a Condition
Post a Comment