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
Related Posts with Making the observations of a string variable as variable names after drop_all
New Stata module to estimate permanent-transitory state space modelscdecompose: Stata module to estimate permanent-transitory state space models is now available in SSC…
Test for differences between Cumulative Incidence Function curvesHello, I have a two-arm trial where an event can either occur or does not occur because of a compet…
Help with re-formatting a dataset for choice modelling?Hi folks. I have data in the following format. Each observation represents a zip code, n_sites denot…
Multiple twoway lines in same graph region.Dear All, I have a 50 US state panel by day. A policy of interest is implemented in the different s…
Accounting for imperfect diagnostic test results on data from an entire populationHello, I have data from a seroprevalence study which collected samples from an entire population (a…
Subscribe to:
Post Comments (Atom)
0 Response to Making the observations of a string variable as variable names after drop_all
Post a Comment