Announcement

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

  • Creating biological and step families with the new ADD Health Parent Data

    Hello Statalist!

    I am fairly new at analyzing data and I am hoping someone will be able to help me understand what is going on with my code and what to do when handling this type of data. I am trying to create 2 variables, one that is full (2) Biological parents and then the other being having at least 1 step/other parent. The "parent1" variable is the parent that is responding to the survey. The "spart" variable is the spouse/partner responding to the survey. This survey collected information from the parents only. This data comes from the Add Health Wave V Parent Data.

    With that being said, there are a few sets of parents that are both step-parents to the child, so I need to account for that as well.

    Here is how I have coded the parent variables:

    *BIO/ADOPTED/STEP/OTHER FOR PARENT1
    tab p2wp3b, nolabel
    recode p2wp3b (1 2=1) (3=2) (4= 3) (6= 4)(96 97 98=.) , gen (parent1)
    lab def parent1 1 "bio/adopted" 2 "step child" 3 "spart child" 4 "other"
    tab parent1
    tab parent1, m


    *BIO/ADOPTED/STEP OTHER FOR SPART
    tab p2wp3c
    recode p2wp3c (1 2=1) (3=2) (4= 3) (6= 4)(96 97 98=.) , gen (spart)
    lab def spart 1 "bio/adopted" 2 "step child" 3 "spart child" 4 "other"
    tab spart
    tab spart, m


    Here is the code I have tried to target the parents that are 100% biological or at least 1 non-biological (I do not think this has worked):

    *creating a bio/bio only relationship
    gen biorelate=0
    replace biorelate=1 if parent1==1 & spart==1

    tab biorelate, m

    *creating a bio/step only relationship
    gen steprelate=0
    replace steprelate=1 if parent1== 2 & 3 & 4
    replace steprelate=1 if spart== 2 & 3 & 4

    if (parent1==2 | parent1==3 | parent1==4 | spart==2 | spart==3 | spart==4)

    tab steprelate, m

    tab2 biorelate steprelate, m


    Here is the output of the tab2 --> note that 0 bio/ 0 step relationship means that these people are 1 step and 1 bio, so this would be categorized as the step relationship that I am trying to get at:


    -> tabulation of biorelate by steprelate
    | steprelate
    biorelate | 0 1 | Total
    -----------+----------------------+----------
    0 | 1,235 1,233 | 2,468
    1 | 1,579 0 | 1,579
    -----------+----------------------+----------
    Total | 2,814 1,233 | 4,047





    I believe that I have to make the step category opposite of the bio-only category but I am not sure if this will work because I have a few people who have 2 step parents... The categories I want in the end are dichotomous: Both Biological Parents and then at least 1 Step-Parent.

    I appreciate anyone's help in advance. Thank you.

  • #2
    As you provide no example data, it is very hard to follow what you are trying to do here.

    Nevertheless, the following commands jump out as probable errors:

    Code:
    replace steprelate=1 if parent1== 2 & 3 & 4
    replace steprelate=1 if spart== 2 & 3 & 4
    While they are legal syntax, I would be astonished if they do what you want. The use of the logical & operator tells Stata that you are dealing with logical expressions. Logical expressions in Stata are evaluated in Stata as follows: 0 is false, anything other than zero, including missing value, is true. So 2 & 3 & 4 evaluates as true & true & true, which is, of course, true. And the when calculating a logical expression, the result false is returned as 0 and true is returned as 1. So these two commands are actually equivalent to:

    Code:
    replace steprelate=1 if parent1== 1
    replace steprelate=1 if spart== 1
    I'm willing to bet that this is, in fact, not just not what you wanted, but is the opposite of what you wanted.

    On the guess that what you meant is that you want to replace steprelate = 1 if parent1 is in the set {2, 3, 4}, or if steprlate is, then the correct code for that is:

    Code:
    replace steprelate = 1 if inlist(parent1, 2, 3, 4)
    replace steprelate = 1 if inlist(spart, 2, 3, 4)
    Or, in fact, you can reduce that to a single command:
    Code:
    replace steprelate = 1 if inlist(parent1, 2, 3, 4) | inlist(spart, 2, 3, 4)
    I don't know if this completely solves your problem, but make these changes and see where you stand. If at that point you need additional help, post back, and be sure to use the -dataex- command to show example data that illustrates your problem. 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.

    Comment


    • #3
      Hi Clyde, thank you so much for your help with this!

      Comment

      Working...
      X