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
Inquiry about randomization (block size 4, 1:1 allocation)Hello, I'm conducting Stata command for randomization with the following details: Treatment group …
Diagnostic Tests Panel DataDear all, I am working on my thesis using panel data in Stata but we never really discussed this in…
Using asdoc, acum to store values that I can write laterI am trying to use asdoc to create a table with the data I want. I first use: Code: sum XYZ if tin…
Using esttab to show both linear regression and logistic regression (odds ratio) outcomesHello, I'm trying to display 3 regression outcomes together by using Code: esttab command. Among t…
Obtaining milliseconds from -now()-According to the documentation: tc = now() where tc: number of milliseconds from 01jan1960 00…
Subscribe to:
Post Comments (Atom)
0 Response to Rank with a Condition
Post a Comment