Announcement

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

  • combining 2 datasets without common variable

    Hi,
    i have exported two t_tables from Access databases that i need to re-merge together in stata.
    1) the 1st table is a longitudinal multiple observations per patient table like this :

    ID Age0 sex dateofvisit ...
    1 14 M 12Jan17
    1 14 M 12mar17
    1 14 M 12apr17
    2 21 F 12mar17
    2 21 F 25jun17
    3 50 M 01mar17
    3 50 M 11Feb17
    3 50 M 31aug17

    2) the 2nd database is the table with the Healht facility characteristics (just 1 line)

    Sitecode type Name Province Distrito datestartARV
    030 Hospital Luzia Faro Loule 01Jan2001

    so between the 2 datasets there is no common variable for the use of "merge" or "joinby"....is there a way to merge the 2 datasets so the variables from the 2nd dataset repeats themselves on all observations of all lines in the 1st dataset ?
    thank you in advance for your help
    L

  • #2
    if I understand you correctly
    Code:
    help joinby
    note that -joinby- does not require a varlist (or varname) as you seem to think

    Comment


    • #3
      The help file for joinby states that:
      If varlist is not specified, joinby takes as varlist the set of variables common to the dataset in memory and in
      filename.
      and if you use it and there is no common variable, you will get the following error message:
      Code:
      no variables in common to master and using data
      thus a join is not possible
      r(198);
      What you need here is cross.

      Comment

      Working...
      X