Hello,
I have one dataset (called Natural Disaster) with three variables: Year, CountryCode, and TotalAffected. Since countries can have more than one natural disaster every year, there are often multiple entries with the same Year and CountryCode
I have one dataset (called Population) with many variables: one named CountryCode, and the rest corresponding to years (from 1980-2018). So each row of this dataset contains the country's code, and that country's population over the period 1980-2018.
I want to create a new variable, PercentageAffected, in the Natural Disaster dataset. This is equal to (TotalAffected/Population in that year and in that country).
To do that I would have to create a Population variable in the Natural Disaster dataset.
I'm not sure how to transfer the population data from my Population dataset into the Natural Disaster dataset, such that the new Population variable in the Natural Disaster dataset contains the value of the population corresponding to the correct CountryCode and Year.
I would appreciate help with this, and please let me know if this question was unclear. Thanks!
Related Posts with Combining two datasets on two variables.
Clique identification within larger networkI am interested in identifying cliques of entities (think of groups of common friends within a socia…
How can determine the best cut point with large number of observationI have data set contains 300 observation and when I am using the Roctab command to calculate sensiti…
Calculating ratios in panel dataI searched Stata help and this forum but found no solution. I want to calculate some simple ratios o…
Divide population according to predefined predicted probabilities cut-offsDear all, I run a logistic regression model with predictors (age, diabetes, hypertension, tobacco)…
Merge if mergeHi, I have used the command "merge", creating a new var called "epr" instead of "_merge": merge m…
Subscribe to:
Post Comments (Atom)
0 Response to Combining two datasets on two variables.
Post a Comment