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?
Fixed Effects Model with Time Invariant Independent VariablesI am working with a panel data set in Stata 16.1 that has 14,690 observations and 19 variables. I am…
Two - step dynamic panel GMM estimator weight Matrix returning blank value after Mata loopHey guys, I am running a two-step joint dynamic panel GMM estimator on Mata, with the stacked formu…
Heat maps according to datesDear friends, I am interested in build the attached graph. I was exploring in stata with several com…
xtaond2Hello, Would someone please tell me why the estimation results of the following two xtabond2 comman…
query about stata codeHello, I would like to confirm whether I generate a variable in a proper way. The definition is as f…
Subscribe to:
Post Comments (Atom)
0 Response to How to rename dummy variables based on category names?
Post a Comment