Hi, I am working with a large Stata dataset that contains individual-level information (file1.dta), for example
I would like to merge this dataset with a state-level file (file2.xls) that contains data on GDP, population, and so on for each state per year. The second file looks like this:
The final file should look as follows:
I wonder what is the easiest way to achieve this. Any suggestion would be most welcomed. The individual data file has 42 million observation, so a manual approach is unfeasible.
Thanks.
Name | State | Salary | Year | Height |
John | Nebraska | 35000 | 2016 | 178 |
Mary | Texas | 42000 | 2014 | 157 |
State | GDP 2014 | GDP 2016 | Population 2014 | Population 2016 |
Nebraska | 20 | 25 | 100 | 150 |
Texas | 30 | 35 | 200 | 300 |
Name | State | Salary | Year | Height | GDP | Population |
John | Nebraska | 35000 | 2016 | 178 | 25 | 150 |
Mary | Texas | 42000 | 2014 | 157 | 30 | 200 |
Thanks.
Comment