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
What pseudo R squared and chi2 obtained with -pstest- mean?Dear All, I have run -pstest- after matching. I have explained the standardised bias and the mean b…
Question on AIC (and Log-likelihood)Hello everybody. I would have two quick theoretical questions on the AIC, which raised when perform…
Generate time value with year and quarter and xtsetI have 3 variable variable year with value from 2000-2010 variable quarter with value from 1-4 varia…
elasticity calculation with a factor variable regressionhi dear all statalisters, I now face a problem in getting the elasticity after running a logit model…
Too large R SquaredI regressed the loan rate on firm variables and loan characteristics and yield a way too high r squa…
Subscribe to:
Post Comments (Atom)
0 Response to Rank with a Condition
Post a Comment