[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: How to quickly merge by the range of a third variable?
I have a quick question about how to speed up the merging process.
Suppose I have one A dataset and several B dataset, denoted as B1, B2, B3, etc.
In A dataset, I have individuals' id numbers along with his/her birth
city and birth year. Now in B's datasets, it stores the information of
all the cities in a particular year, such as B1: all the cities for
year 1, B2: all the cities for year2, B3 for year3, etc. For example,
in year 1, I can get every city's population size for that year.
Now my goal is to get each individual's birth city population size, of
course, for that particular year when the individual was born. To
summarize, in dataset A, I have the following variables:
id birthyear birthcity
in B's datasets, I have
I am aware that I should merge the right B dataset with A through
city, however, which year when the individual was born determines
which B dataset I should merge for that observation. I didn't find by:
or if... conditional command for "merge", as I imagined.
Is there a quickest way to finish this mission?
* For searches and help try: