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.