Hi!
This might be a bit of a basic question but I have a continuous variable x and I want to create a dummy variable y that uses the mean of x as a cut off. So if x> mean of x then y =1.
Is it possible to use statistical properties as a cut-off points?
I was thinking something like
gen y=0
replace y=1 if x> mean(x)
However, this does not seem to be a valid command. I know I could just use the actual nummerical value of the mean but I am looking for a more elegant way of doing it in case that value changes.
Any ideas?
This might be a bit of a basic question but I have a continuous variable x and I want to create a dummy variable y that uses the mean of x as a cut off. So if x> mean of x then y =1.
Is it possible to use statistical properties as a cut-off points?
I was thinking something like
gen y=0
replace y=1 if x> mean(x)
However, this does not seem to be a valid command. I know I could just use the actual nummerical value of the mean but I am looking for a more elegant way of doing it in case that value changes.
Any ideas?