For a project, I would like to create a variable, which in my opinion is pretty complex. But I'm very new to Stata, and hope one of you can help me out.
My data has 3 vars: country, and city, pop.
E.G:
Country City Pop
U.S City 1 200M
U.S City 2 190M
U.S City 3 100M
U.S City 4 10M
.
.
.
Canada City 1 120M
Canada City 2 100M
Canada City 3 90M
.
.
.
China City 1 1200M
China City 2 100M
China City 3 700M
I would like to create a var 4 that will assign numbers to the cities of the countries based on the population.
For example, Var 4, would give city 1, a value of 1 because it has the highest pop and city 2, a value of 2 and so on. Keeping in mind that I have a very large data set and it is not ordered in any logical fashion.
Any help or pointers in the right direction would be very much appreciated!
Thanks!
My data has 3 vars: country, and city, pop.
E.G:
Country City Pop
U.S City 1 200M
U.S City 2 190M
U.S City 3 100M
U.S City 4 10M
.
.
.
Canada City 1 120M
Canada City 2 100M
Canada City 3 90M
.
.
.
China City 1 1200M
China City 2 100M
China City 3 700M
I would like to create a var 4 that will assign numbers to the cities of the countries based on the population.
For example, Var 4, would give city 1, a value of 1 because it has the highest pop and city 2, a value of 2 and so on. Keeping in mind that I have a very large data set and it is not ordered in any logical fashion.
Any help or pointers in the right direction would be very much appreciated!
Thanks!