next up previous
Next: Ignoring data Up: No Title Previous: Graphs in Stata

More data modification

Earlier we created a simple binary variable using the command

generate binalc=alcohol>2

There are two problems with this method. The obvious one is that it only works for creating binary variables. Less obviously, it gives the wrong answer when there are missing observations. In Stata a missing observation behaves like a very large number and so will be recoded to 1 along with the higher levels of alcohol consumption.

There are a number of other useful ways to recode variables



next up previous
Next: Ignoring data Up: No Title Previous: Graphs in Stata



Thomas Lumley
Wed Jan 22 09:16:46 PST 1997