Dear Stata experts,
I would need to generate a variable whose observations are other variables' names repeated for the number of categories they have. Let's say, the variable "age" has two categories (e.g. "0-18" "19-25") and the variable "gender" has two categories (e.g. "female" "male"). I would like to generate a new variable "var" which looks like this:
var
age
age
gender
gender
Is there a way to do it? Thank you in advance!
I would need to generate a variable whose observations are other variables' names repeated for the number of categories they have. Let's say, the variable "age" has two categories (e.g. "0-18" "19-25") and the variable "gender" has two categories (e.g. "female" "male"). I would like to generate a new variable "var" which looks like this:
var
age
age
gender
gender
Is there a way to do it? Thank you in advance!
Comment