Announcement

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

  • Trying to merge two variables for the same observation

    Hi everyone,

    I am relatively new to using Stata and over the last year, most of my queries have been answered by someone else's question posted on this forum. After a year of lurking, I decided to create an account to ask for help directly for a new project I am working on.
    I am working on a health project and I collected survey data for patients at two different times (June and September). The survey asked for the Date Of Birth of the head of the family. So in my dataset I have the junedob and septdob for the head of the family. In some (most) cases, the DOB are the same for the two months, in some cases, they are missing from one variable or different. I was wondering what the best way to combine these two variables into a new variable(mergeddob). So that when junedob and septdob match mergeddob match the DOB of the two variables but when it doesn't I want it to show up as missing. Sorry if this is an overly simple or noob question to ask.
    ID junedob septdob mergeddob
    345 1/28/1924 1/28/1954
    346 . 6/18/1977
    357 2/3/1936 4/19/1944
    388 9/12/1982 9/12/1982
    356 . .

    Thank you for taking the time to read through my post.

  • #2
    I did some more digging and found my answer on Statalist:

    https://www.statalist.org/forums/for...-other-columns

    This site always helps!

    Comment

    Working...
    X