I have a variable with city names and I want to create a new variable which a unique number for each city.
I want my dataset to look like as follows:
CITY_NAME CITY_ID
Delhi 1
Delhi 1
Kolkata 2
Mumbai 3
Mumbai 3
Pune 4
How do I generate the numerical variable CITY_ID from the variable CITY_NAME?
Related Posts with How do I generate a numerical variable from a string variable?
Heckman Error in First stageHi
I run the Heckman two step selection model by using following stata code. I am using stata 15.1 v…
Need help in generating a categorical variableHello,
I am having trouble generating a categorical variable by the name of Age which is supposed t…
Loop, one-tailed p value, two-tailed p valueHi
I am running regressions by industry and year groups where the number of firms in the industry an…
What is the best method / code of calculating respondents' ages?I have two variable: Q26 (month) and Q27 (year).
Q26: What month were you born? The answer is 12 mon…
Graphically show the interaction effect, panel dataHi everyone,
I am estimating a moderating effect with a random effects regression model and it give…
Subscribe to:
Post Comments (Atom)
0 Response to How do I generate a numerical variable from a string variable?
Post a Comment