Hi, all.
I have a data set with variable "town_id" indicating town id (such as 160, 155, 178, etc.).
I want to create a set of dummy variables based on this town variable. AND I want to name the variables in the form of "town_id_x", where x is the numeric town id.
Currently, I use tabulate town_id, gen(town_id), with which I can create all dummy variables but the names are town_id1,town_id2,town_id3...But I want the names be "town_id160, town_id155, town_id178".
Anyone can share your knowledge? I have searched for a while but still do not know how.
Thank you very much.
Related Posts with How to rename dummy variables based on category names?
IV-panel-xtivreg: zero coefficient; time fixed effectsHello Statalist! I'm doing the project about UIP(uncovered interest rate parity) and illiquidity ris…
Divide the string including chinese into two columnsdear sir: I want to know how to divide the following strings into two columns, one for Chinese chara…
Contingent Valuation MethodHi! I am trying to make a study in regards to contingent valuation method using logit, which is in m…
Panel data regression - problems getting reasonable results on debt ratioHi everyone, I'm running a regression on my panel data, where the results I'm getting on my debt ra…
repeating iterations with unchanging log likelihood valuesGreetings all, I am using meqrlogit to predict binary outcome (use of potentially harmful medicatio…
Subscribe to:
Post Comments (Atom)
0 Response to How to rename dummy variables based on category names?
Post a Comment