Hi there,
I am trying to inverse rank a variable (Fractionaccel_over425mg) in Stata using the code below. The first line (rank) works fine (I have over 90,000 observations) but then when I use the invnorm function it suddenly says I have no observations. I suspect this is something to do with the fact that there are a lot of people with the same value (e.g. there are >18,000 with a value of 0)?
egen rankFractionaccel_over425mg = rank(Fractionaccel_over425mg)
count if Fractionaccel_over425mg!=.
gen invrankFractionaccel_over425mg = invnorm(rankFractionaccel_over425mg - 0.5)/r(N)
I have tried using the rank, unique function below but this still didn't work as it then said I only had 1 observation.
egen rankFractionaccel_over425mg = rank(Fractionaccel_over425mg), unique
count if Fractionaccel_over425mg!=.
gen invrankFractionaccel_over425mg = invnorm(rankFractionaccel_over425mg - 0.5)/r(N)
I'd be grateful for any advice on how I can get this to work.
Many thanks,
Mel
I am trying to inverse rank a variable (Fractionaccel_over425mg) in Stata using the code below. The first line (rank) works fine (I have over 90,000 observations) but then when I use the invnorm function it suddenly says I have no observations. I suspect this is something to do with the fact that there are a lot of people with the same value (e.g. there are >18,000 with a value of 0)?
egen rankFractionaccel_over425mg = rank(Fractionaccel_over425mg)
count if Fractionaccel_over425mg!=.
gen invrankFractionaccel_over425mg = invnorm(rankFractionaccel_over425mg - 0.5)/r(N)
I have tried using the rank, unique function below but this still didn't work as it then said I only had 1 observation.
egen rankFractionaccel_over425mg = rank(Fractionaccel_over425mg), unique
count if Fractionaccel_over425mg!=.
gen invrankFractionaccel_over425mg = invnorm(rankFractionaccel_over425mg - 0.5)/r(N)
I'd be grateful for any advice on how I can get this to work.
Many thanks,
Mel
Comment