*(Q) Assume the data looks like this (a CH_ID that ends in 00 is actually the parent, whose information I am trying to impute into the children): PAR_ID CH_ID VAR1 VAR2 X001 X00100 2 1 X001 X00102 . . X001 X00103 . . X002 X00200 1 . X002 X00201 . . X003 X00300 3 2 X003 X00302 . . X003 X00303 . . I would like to know if anyone has a script (or modification of the one above) that fill in all the missings for each X00's child with the- but NOT run into the next person. That is, not fill in the missing under VAR2 for X002, because that is a new person and the "1" under VAR2 for X001 is not applicable to that person. The corrected dataset would look like: PAR_ID CH_ID VAR1 VAR2 X001 X00100 2 1 X001 X00102 2 1 X001 X00103 2 1 X002 X00200 1 . X002 X00201 1 . X003 X00300 3 2 X003 X00302 3 2 X003 X00303 3 2 * (A) Posted to newsgroup by Ray on 2002/02/18. DATA LIST LIST /PAR_ID (A4) CH_ID(A6) VAR1 VAR2 (2F8.0). BEGIN DATA X001 X00100 2 1 X001 X00102 . . X001 X00103 . . X002 X00200 1 . X002 X00201 . . X003 X00300 3 2 X003 X00302 . . X003 X00303 . . END DATA. LIST. SET ERRORS=no. DO IF $CASENUM>1. DO IF par_id = LAG(par_id). DO REPEAT v=ch_id TO var2. * The next 2 lines are a nice trick: * one the 2 line results in a (non consequential) error * but the other gives the correct answer. IF LEN(RTRIM(v))=0 v=LAG(v). IF MISSING(v) v=LAG(v). END REPEAT PRINT. END IF. END IF. SET ERRORS=yes. EXECUTE. LIST.