Hi!

I am trying to create new variables using quantiles. This is what I have done so far:

Using xtile, I created 3 quantiles and tabulated to show the mean of each quantile. Like this:

xtile quantiles_3 = data, nq(3)

tabstat data, stat (n mean) by (quantiles_3)


Creating a dummy variable will allow me to manuaally input the ranges for the quantiles. For instance,
  • Quantile 1 is between 0 and 12
  • Quantile 2 is between 12 and 28
  • Quantile 3 is between 28 and 87
  • Quantile 4 is anything greater than 87
Question: How can I make the dummy variable with those ranges? Is there a quicker way to save the quantiles as independent variables?

Thank you!