Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65055

Transforming a continuous variable to a binary variable

$
0
0
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?

Viewing all articles
Browse latest Browse all 65055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>