Hi,
I have a datasheet that has a string variable named "person" with observations like "AM", "MF", "KR", "PM", "RR", etc.
what I want to do is to sum a list of all unique observations of this variable, then drop everything, then in a new spreadsheet generate new variables with the name of these observations like "AM", "MF", "KR", etc.
What I did was (in short form):
levelsof person
drop _all
foreach x in `r(levels)' {
gen `x' = .
}
But this does not work and I guess it is because it cannot read from a string list.
Do you have any idea how I can come over this? and how can I make variables from a list of single observations from an already dropped string variable?
Thank you
0 Response to Making the observations of a string variable as variable names after drop_all
Post a Comment