Exercise

  1. Combine the data stored in “trade_data_country.dta” and “other_data_country.dta”. Explain why you append or merge and the reasoning behind your code.
  2. The datasets "households_exercise.dta" and "household_members_exercise.dta" contain similar observations as in the lecture example. However, this time the identifiers in both datasets are in string format. Note that the identifier in the household member dataset is not just a code for the household but a composite code for the household and the household member. Combine these two datasets as follows:
    • Open "household_members_exercise.dta" and create a household identifier that corresponds to the identifier used in "households_exercise.dta". (Hint: You might need some of the following commands/functions: destring, tostring, floor, substr or length).
    • Merge both datasets.
    • Check if the merging procedure worked correctly with the help of the household size indicator.