Announcement

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

  • Merge longitudinal data

    Can you merge data from two time points within the same data set? I have a single data set with variables from two separate time points. I am supposed to analyse these but have been asked to merge the variables so that the data from both time points can be traced back to each other. Is this possible?
    One way i thought would be to create separate data files for both time points then merge the observations. Would this work? Or can we merge variables from the same data set?

  • #2
    Bumping is discouraged here on Statalist. You asked this same question just over 20 minutes ago. This is not a paid help-line. It is a community of users who share their knowledge of Stata, when it is convenient for them to do so. If your question is so urgent that you need help that quickly, this venue will rarely prove suitable, and when it does, it will just be a matter of luck that somebody happened to see your question and choose to answer it shortly after you post it. One should always expect a lag of several hours or a day (maybe even two when weekends or holidays intervene) here.

    That said, when you do not get a timely response, simply reposting the same question is usually a waste of your time. When questions get no response it is either because nobody knows enough about it to provide a useful answer, or, more often, because the question is asked in a way that is confusing or does not provide enough information for anyone to answer. Your question here fits this last category.

    When asking for how to code something, you can almost never get a useful answer without showing example data that those who want to help you can work with. That means using the -dataex- command. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    So, in order to improve your chances of getting a helpful and timely response, I recommend you repost your question, as a continuation of this thread, using -dataex- to provide examples from both of the data sets you want to combine. And, of course, be patient even so.

    I realize you are relatively new to Statalist, so I suggest that you learn the customs that prevail in this community by reading the Forum FAQ. That will prevent future misunderstandings.

    Comment


    • #3
      Hi Clyde, Sorry didnt mean to offend. I posed it as two separate questions because one was about merging two data sets and the other was about merging observations within one data set. I in no way meant to rush anyone for a response due to urgency. I understand this is a platform where generous people like yourself help others with limited or minimal knowledge of stata. I will be more mindful of the customs of the platform to avoid any offense or misunderstandings in the future. Thank you for your time and advise. Will repost with the required code and clarity in the thread.

      Comment


      • #4
        If you have two datasets sharing the same set of variables and each representing a particular time period, then you are more likely looking to append the datasets rather than merging. See

        Code:
        help append

        Otherwise, as Clyde advises, the best way to get a helpful reply is to enclose a data example using dataex (see FAQ Advice #12 for details).

        Comment


        • #5
          Thank you all for your help. I figured it out. All I needed to do was generate new ids in both data sets then do a m:1 merge using the generated IDs. This seems to have merged all the variables from both master and using file.
          Appreciate the advise.

          Comment

          Working...
          X