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?
Loop over file namesHi, I have been trying to loop over some file names. I have something like this: foreach s of num …
Rescale a variable between 0 and 1 within industryDear Stata Users, I have a continuous variable “spread1”. I want to rescale it within industry – “s…
Bootstrapping with SUESTHi everyone, I should use Stata to make a mediatior analysis. I used the SUEST and I should do the …
Colour coded scatter graphHi, I would like to create a scatter plot. I have count data for both variables in question, and mos…
Interpretation of threshold resultDear Community, I am a user of Stata 15. I am trying to estimate the threshold effects of inflation…
Subscribe to:
Post Comments (Atom)
0 Response to How do I generate a numerical variable from a string variable?
Post a Comment