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?
Struggling with Collinearity in Panel DataHi, I am struggling with how to set up my regression robustness check. I am currently running a reg…
Problems with Nesting in Panel Regression "panels are not nested within clusters"Hi, I am not sure how to overcome this error message I am receiving "panels are not nested within c…
Exporting underlying data behind stata generated graphsHi, i was able to export the underlying data behind a graph i created using a dataset (below) but wh…
Replace missing observations in VAR1 with observations from VAR2 fDear forum, I am trying to replace the missing observation(s) in ExportMarkets with the value in Mi…
problema with local extended_fcn local list : dir . files "*"Hello everyone. this is my first post in Statalist, so please forgive any mistake on it. I'm tryin…
Subscribe to:
Post Comments (Atom)
0 Response to How to rename dummy variables based on category names?
Post a Comment