Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merging datasets but lacking key variables

    Hello, I am trying to merge two datasets with the goal of including the variables size and group_numb (number of groups) from the user dataset in the master dataset. However, the only variables shared by both datasets are country and year, which do not uniquely identify the observations of size and group_numb. However, groupid and year can indeed identify size and group_numb. In this case, I suppose I have to create the groupid variable in the master dataset in order to complete the merge.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long groupid str37 country float(year size group_numb)
    1000 "Guinea-Bissau" 1990 .3 4
    1000 "Guinea-Bissau" 1991 .3 4
    1000 "Guinea-Bissau" 1992 .3 4
    1000 "Guinea-Bissau" 1993 .3 4
    1000 "Guinea-Bissau" 1994 .3 4
    1000 "Guinea-Bissau" 1995 .3 4
    1000 "Guinea-Bissau" 1996 .3 4
    1000 "Guinea-Bissau" 1997 .3 4
    1000 "Guinea-Bissau" 1998 .3 4
    1000 "Guinea-Bissau" 1999 .3 4
    end


  • #2
    This is very closely related to https://www.statalist.org/forums/for...erge-follow-up.

    To avoid confusion, I recommend that this thread be considered closed and further discussion be placed there--two replies have already been posted there.

    Comment

    Working...
    X