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?
Looping and importing excel sheetsHi all, I am importing 12 files from excel. These worksheets have common name starting from II1 to …
Creating a variable: TRUE or FALSE based on date within two other dates for each participant of of which there are multiple ID valuesHello, my apologies for not using dataex. I am using healthcare data so I have created an example be…
Stacked/Bar Graphs for Multiple Categorical VariablesHello, I am examining socio-demographic differences in attitudes towards FGC practice. Here is an e…
Linearity assumption in LogisticHi statalist. I wonder during logistic regression, do I have to check linearity assumption between c…
net install lpdensity, error r(677)Hi, I use rddensity in Stata and already have rddensity installed on my computer but then a error r…
Subscribe to:
Post Comments (Atom)
0 Response to How do I generate a numerical variable from a string variable?
Post a Comment