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?
Monte Carlo simulation comparing output for OLS and 2SLS by saving beta and se's in matrixHi In my simulation I am trying to compare output from OLS and 2SLS. I have the following code which…
xtlogit or pooled logit with repeated cross sectionsDear all, I read a lot of the posts here about this topic but I got confused about something. So I w…
Instead of IV, can I simply run an OLS with the compliers?Imagine that I have a dummy variable that is a proper instrument. It identifies which observations o…
Using drop-command for a variable depending on the value of another variableHi, for my cumulative dataset (European Social Survey 2002-2018) I have a variable which measures if…
Panel data for for asset pricing modelsHi, Im working on my masters thesis. I have unbalanced panel data, for about 1550 individial mutual …
Subscribe to:
Post Comments (Atom)
0 Response to How to rename dummy variables based on category names?
Post a Comment