Convert individual level data to dyadic level

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

statsgirl
Posts: 16
Joined: Sat Aug 04, 2012 1:52 am

Convert individual level data to dyadic level

Postby statsgirl » Sat Aug 04, 2012 2:07 am

I am working with a large dataset with married couples data. At present, the data is individual level. I have been tasked with the assignment to pair all couples together within the data, so we can analyze the data at a dyadic level. There are only two variables that can provide a match between members of a couple. Each person reported their birth date, and their partner's birth date. I am trying to figure out how to write out syntax to compare birth date for each case to every other case's "partner's birth date" variable, in order to help me identify couples. Is this possible? To make things a little bit more complicated, the "birth date" variable is a date variable written in mm/dd/yy format, while partner's birth date is a date variable written as mm/dd/yyyy.

Any help anyone can offer would be greatly appreciated!
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Convert individual level data to dyadic level

Postby Penguin_Knight » Sat Aug 04, 2012 4:19 am

Heterosexual couples only? Do you have sex variable?
statsgirl
Posts: 16
Joined: Sat Aug 04, 2012 1:52 am

Re: Convert individual level data to dyadic level

Postby statsgirl » Sat Aug 04, 2012 4:24 am

There are some homosexual couples present too.
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Convert individual level data to dyadic level

Postby Penguin_Knight » Sat Aug 04, 2012 12:29 pm

Well... first you can split the file into file, one with only males and one with only females. There you can use the birthday to merge most of them. For the rest, they are probably i) homosexual, or ii) not remembering their spouse's birthday correctly. In those case, you can use a function like this to pair them up:

Code: Select all

COMPUTE daydiff = ABS(bday1 - bday2) + bday1 + bday2 .
EXECUTE .

SORT CASES BY daydiff(A).

FREQUENCIES VARIABLES=daydiff
  /FORMAT=DFREQ
  /ORDER=ANALYSIS.
Check the frequency table carefully and see if the frequencies are all 2, if they are, then you luck out. If there are some 4 or 6, go to those cases and manually fix them by adding say 0.1 to the duo's daydiff data. Remake the frequency table until you don't see any number larger than 2. Now run this:

Code: Select all

FREQUENCIES VARIABLES=daydiff
  /FORMAT=AFREQ
  /ORDER=ANALYSIS.
Not everyone remember their spouse's birthday correctly. Check the frequency table carefully and see if the frequencies are all 2. If there are some 1, go to those cases and manually pair them by making their daydiff data the same. Remake the frequency table until you don't see any number smaller than 2.

When all set, right this:

Code: Select all

SORT CASES BY daydiff(A).

IF $CASENUM = 1 ordernum = 1 .
EXECUTE .

IF daydiff = lag(daydiff) ordernum = lag(ordernum) .
IF daydiff ~= lag(daydiff) ordernum = lag(ordernum)+1 .
EXECUTE .

IF $CASENUM = 1 filenum = 1 .
EXECUTE .

IF ordernum = lag(ordernum) filenum = 2 .
IF ordernum ~= lag(ordernum) filenum = 1 .
EXECUTE .
They you should be able to merge the rest. I really didn't explain the merging in detail because it's not in the question. You do need to rename all variables in one of the half file otherwise the merging will not happen.

And just want to say that these are just fragments of functions and thoughts about the merging. You'll need to come up with your own detailed protocol before going on. Making the cases identifiable is the first step, if the cases do not have an ID number assigned, then use:

Code: Select all

COMPUTE id = $CASENUM .
to get an ID number first before starting anything, that should make your life relatively easier.
statsgirl
Posts: 16
Joined: Sat Aug 04, 2012 1:52 am

Re: Convert individual level data to dyadic level

Postby statsgirl » Mon Aug 06, 2012 6:24 pm

Thank you, that is very helpful! I am following your suggestion right now. I am noticing that the DayDiff variable gets the exact same values for some birthdates that are different, but close together. For example, for two couples, one partner had a birthdate of 4/21/62. However, even though the other partner's birthdates (3/27/71 and 3/27/68) were slightly different, both couples received the same score on the DayDiff variable. Any idea on how to alter the DayDiff variable so it is slightly more discriminating?
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Convert individual level data to dyadic level

Postby Penguin_Knight » Mon Aug 06, 2012 9:21 pm

^ Wow... couldn't guess that'd happen... that's why I also added the two original values into the difference to begin with.

You may try add one more algorithm, like (absolute difference)/(the smaller of the two birthdays) as a second distinguishing variable.
statsgirl
Posts: 16
Joined: Sat Aug 04, 2012 1:52 am

Re: Convert individual level data to dyadic level

Postby statsgirl » Mon Aug 06, 2012 9:37 pm

Good idea! Thanks so much!

Who is online

Users browsing this forum: No registered users and 1 guest

cron