Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The code below was tested only on your small data snippet. So, no guarantees for all the data with their peculiarities. The code makes the assumption that AGE is integer.</p> <pre><code>*Let's add small fractional noise to those children AGE who HASHEALTH=1. *In order to insert the info about health right into the age number. if hashealth age= age+rv.unif(-.1,+.1). *Turn to fathers. Combine POPNUM and PID numbers in one column. compute parent= popnum. /*Copy POPNUM as a new var PARENT. if parent=0 parent= pid. /*and if the case is not a child, fill there PID. *Now a father and his children have the same code in PARENT *and so we can propagate the minimal age in that group (which is the age of the *youngest child, provided the man has children) to all cases of the group, *including the father. aggregate /outfile= * mode= addvari /break= hhid parent /*breaking is done also by household, of course /youngage1= min(age). /*The variable showing that minimal age. *Turn to mothers and do the same thing. compute parent= momnum. if parent=0 parent= pid. aggregate /outfile= * mode= addvari /break= hhid parent /youngage2= min(age). /*The variable showing that minimal age. *Take the minimal value from the two passes. compute youngage= min(youngage1,youngage2). *Compute binary KIDHASHEALTH variable. *Remember that YOUNGAGE is not integer if that child has HASHEALTH=1. compute kidhashealth= 0. if popnum=0 and momnum=0 /*if we deal with a parent and age&lt;&gt;youngage /*and the youngage age listed is not their own and rnd(youngage)&lt;&gt;youngage kidhashealth= 1. /*and the age isn't integer, assign 1. compute age= rnd(age). /*Restore integer age exec. delete vari parent youngage1 youngage2 youngage. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload