Skip to main content
National Longitudinal Survey of Youth 1979 (NLSY79)

NLSY79 Appendix 5: Supplemental Fertility and Relationship Variables

File contents

The supplemental fertility data file, found in the "Fertility and Relationship History/Created" area of interest, contains a variety of constructed and edited variables based on the fertility and marriage histories of respondents, as well as the household record, from the 1979-2022 National Longitudinal Surveys of Youth 1979 cohort (NLSY79). These variables enable users to more easily access the wealth of demographic information provided by the surveys and improve the internal consistency of such data across survey years. The file contains dates of birth, sex, and usual living arrangements for all respondents' children based on a review of the longitudinal data record. Beginning in 1994, the two-digit IDs of the biological children of the female respondents were added to FERTILITY AND RELATIONSHIP HISTORY, as were separate edit flags for male and female respondents. Beginning in 2014, the two-digit IDs of the biological children of the interviewed males have been included and a single edit flag for both male and female respondents has been created. Also included are created variables that summarize dates of marriage(s), number and type of marriage and/or cohabiting relationships, number of live births and other pregnancy outcomes, spacing between births, spacing between first birth and first marriage, and age of the respondent at the time of the first marriage and key fertility events. The variables included in this file are based upon the youth fertility data as revised in a data cleanup program undertaken in 1982-1983 with additional editing provided at selected subsequent survey points.

Prior to 2008, the fertility and relationship variables have been produced only as cross-sectional variable sets for each round. Beginning with the 2008 release, a cross-round (XRND) version of these variables is also being released. XRND variables have been created for all respondents using the data from the last point at which the respondent was interviewed.  The XRND variables created include the dates of birth and sex of all biological children, as well as the pregnancy and marriage history variables.  Included in this variable set are some additional variables: the last known residence of each child as well as a year of last interview variable. The last known residence variables are intended to help users to easily identify children who are deceased or adopted out.  These last known residence variables in no way replace the year-specific residence variables, which are likely to be of interest to researchers considering residence trends across time. Users should be careful to note the year of last interview variable, as these XRND variables include data for members of the dropped oversamples as well as respondents who have not been interviewed for many rounds for other reasons. The traditional cross-sectional variables will continue to be available and created for each subsequent round, and the XRND variables will also continue to be updated.

1982 data quality check and 1986-1990 revisions

Many of the inputs into these fertility variables (specifically month and year of child's birth) were revised in 1982 in order to maximize internal consistency across years. All of the fertility-related variables in the current file are based on these "revised" data items, with the exception of those variables created directly from the respondent's household record. The variable R08988.01 (Consistency of Fertility Data 79-82) specifies for each case whether, after revision, any discrepancy in the fertility history from 1979 to 1982 still remains. In general, when a respondent was interviewed each year from 1979 to 1982, the revised 1982 variables give an accurate picture of the respondent's fertility history as of 1982. However, some inconsistencies in the data over the period were irresolvable. In such cases, the original 1982 data were left intact and a code was assigned to indicate the nature of the remaining inconsistency. A code of "1" means that the 1982 data are consistent with previous survey years, "2" indicates that a dating error remains, and "3" means that an error in the number of children still remains as of 1982. When an error on dating and on number of children occurred simultaneously, the respondent was coded as having an error on number of children since this type of misreport was considered to be more serious.

Further edits to children's dates of births for female respondents occurred in 1986 as a result of preparation for the first round of the new child-mother data tape, and in 1987 for male respondents. In 1989, attention was given to correcting subsequent inconsistencies for both males and females. With each successive survey round, an effort is made to fill in previously missing values on children's birth dates and to include children the respondent has previously failed to report. Since 1990, additional information collected on the children of the female NLSY79 respondents and released on the "Children/Young Adults of the NLSY79" file, has been used to help reconcile inconsistent information for those respondents in the Fertility and Relationship History file. In general, the quality of the fertility record for the female respondents is superior to that reported for the male respondents. 

1994 data quality check

Beginning in 1994, the supplemental fertility file includes several variables not available for earlier years. For each child of a female respondent, there is now a two-digit identification number variable, which will allow users to more accurately link data from the fertility file with data from the NLSY79 Child file. There is also a comprehensive edit flag for female respondents, allowing users to know which female respondents have had changes made to their fertility record for each survey year compared to previous data releases and what the nature of the change is. Detailed information about the coding categories is provided in the last section of this document. For male respondents, three types of edit flags are provided: two which show the extent of discrepancies between the most recent fertility record available and the current CRF data, and one which indicates cases edited to correct birth order.

As part of the preparation of the 1994 Fertility and Relationship History file, a major data reconciliation was undertaken, comparing the birth records of the female NLSY79 respondents across years. As a result, users may notice discrepancies in these variables across time. It is important for the user to understand that when a date of birth is corrected, we do not change the data for earlier points in time. Thus, there may be inconsistencies in the dates of birth and ages of specific children between the 1994 data and earlier or subsequent reports.

1993 variable construction

Although NLSY79 respondents were interviewed in 1993, the Fertility and Relationship History area of interest originally did not contain constructed variables for the 1993 survey year. Data collected in 1993 were used in the 1994 data reconciliation, and some information, such as dates of birth and death, were incorporated into the 1994 or later variables where appropriate. As part of the data work for the NLSY79 2000-2002 data releases, however, these 1993 variables were added to the Fertility and Relationship History area of interest.

The set of variables constructed for 1993 is similar to the sets created for other years in which the full battery of pre- and post-natal questions were not asked, such as 1989 or 1991, in that the pregnancy history variables were not created. Dates of birth, sex, and usual residence are constructed for all children, and 2-digit IDs are provided for the children of female respondents. As with the 1994 data, information for the male respondents was not examined as closely as was the information for female respondents. There is a detailed edit flag for the female respondents, as well as the three edit flags for the male respondents. The marriage history variables were also constructed for 1993.

Although the pattern of data evaluation and the creation of edit flags follow that of the 1994 data reconciliation, data comparisons were done only with data from the 1992 survey and earlier. Because of this approach to the data reconciliation and variable construction, the transition from 1993 to 1994 will not be seamless. Users are always advised to use Fertility and Relationship History data from the most recent survey in which a respondent was interviewed.

1979-2022 Relationship History variables

As an outgrowth of research funded by the National Institute of Child Health and Human Development (NICHD), a series of cross-sectional relationship history variables has been added to the Fertility and Relationship History area of interest. Survey staff carefully examined the names and relationships of household members as reported in the household roster, as well as in the marriage history information collected in various rounds. An attempt was made to identify all cohabiting partners listed in the household record at any point and to combine this information with the marriage data reported by respondents. In this way, the number of spouse/partners reported across survey years was identified.

Two variables per survey year have been constructed for all interviews through 2022. For each survey, the first variable (NUMSPPTR##) indicates the total number of spouses/partners a respondent has ever been known to have. The second variable (RELSPPTR##) reports the respondent's relationship to the current spouse/partner. Respondents with no current spouse/partner will have a value of zero on this variable, even if they have reported a spouse/partner in previous rounds. The possible relationship codes are spouse (1), opposite-sex partner (33), same-sex partner (75) or other (36); respondents with no known spouses or partners are coded -999. The code of "other" is used for cases where someone is listed in the household record of a given survey as, for example, an "other non-relative" but is listed as either a partner or a spouse in the preceding or subsequent survey.

These two variables can be used in conjunction to establish a numeric ID for the current or most recent spouse/partner for any given year. The value of the first variable (0-9 as of 2004) is the first digit of the ID, and the value of the second variable (1, 33, or 36) is the remainder. The resulting number indicates the sequential order of the spouse/partner in the respondent's relationship history and the respondent's relationship to that person.

Users should note that the total count of spouses and partners may be understated, because these variables are based on information reported on the interview date. A spouse or partner may have appeared between survey rounds but not have been present at any survey point. Early examination suggests that this applies to only a modest proportion of cases. In some instances, identification of spouses who were present only between rounds may be possible by using the NLSY79 marriage history, as well as the marriage transition information available at each survey point.

2012 expansion of marital transition variables

Prior to the 2012 data release, the supplemental fertility file included constructed variables for dates of marital transition up through the beginning of the third marriage. In order to provide users with the full range of dates of marital transition, survey staff carefully examined all of the marital transition data collected in the NLSY79 to identify marriage transitions beyond the beginning of the third marriage. Beginning with the 2012 data release, constructed variables are available for marital transitions up through the beginning of the seventh marriage. These data will continue to be updated and expanded as needed.

2014 data quality check

As part of the preparation of the 2014 Fertility and Relationship History file, a major data reconciliation was undertaken, comparing the birth records of the male NLSY79 respondents who were interviewed in R26 across previous interview years. As a result, users may notice discrepancies in these variables across time. It is important for the user to understand that when a date of birth is corrected, we do not change the data for earlier points in time. Thus, there may be inconsistencies in the dates of birth and ages of specific children between the 2014 data and earlier or subsequent reports.

There is a comprehensive edit flag for all respondents, allowing users to know which respondents have had changes made to their fertility record for each survey year compared to previous data releases and what the nature of the change is. Detailed information about the coding categories is provided in the last section of this document.

2016 historical reconciliation for females

Prior to the 2016 data release, survey staff carefully examined all of the data collected about children ever born in the NLSY79 for females last interviewed before 1993 and compared these data with the date of birth data in the NLSY79 Child and Young Adult data file. This historic reconciliation resulted in some changes to the dates of birth on a small number of children as well as the addition of a small number of previously missed children.

2018 historical reconciliation for males

As part of the preparation of the 2018 Fertility and Relationship History file, a major data reconciliation was undertaken, comparing the birth records of the male NLSY79 respondents who were interviewed in R28 or had been last interviewed before R26 (2014). As a result, users may notice discrepancies in these variables across time. This historic reconciliation resulted in some changes to the dates of birth on a small number of children as well as the removal of a small number of children determined to be non-biological children.

It is important for the user to understand that when a date of birth is corrected, we do not change the data for earlier points in time. Thus, there may be inconsistencies in the dates of birth and ages of specific children between the cross-round variables and later data and earlier reports.

The supplemental fertility file now includes the two-digit ID for each child of both female and male respondents. Users should exercise caution when using the two-digit IDs of the children of male respondents to connect data from past rounds, as there is greater inconsistency in these than in the IDs of the children of female respondents. 

Published reports

Since 1982, the NLSY79 fertility data have been collected with the support of funding from the National Institute of Child Health and Human Development (NICHD). The 1982 data quality check was also completed under the auspices of NICHD. A comprehensive description of the evaluation procedures used in revising the data, as well as a variety of tabular and multivariate analyses, can be found in the reports entitled "Fertility-Related Data in the 1982 National Longitudinal Survey of Work Experience of Youth: An Evaluation of Data Quality and Some Preliminary Analytical Results" and "Evaluation of Fertility Data and Preliminary Analytical Results from the 1983 (5th round) Survey of the National Longitudinal Surveys of Work Experience of Youth," both prepared by Frank L. Mott, Center for Human Resource Research. The latter report also includes a detailed evaluation of the NLSY79 abortion data. Additional tables referencing the 1986 data can also be found in "Selected Tables: National Longitudinal Surveys of Youth Cohort, May 1987." Evaluations of the marital history data are provided in R. Jean Haurin, "Inconsistencies in the NLSY Marital History Data - 1986 Supplemental Fertility File" and "Marriage and Childbearing of Adults: An Evaluation of the 1992 National Longitudinal Survey of Youth." These reports are available from NLS User Services.

Questions regarding the nature of the fertility data should be directed to Canada Keck, who can be reached via email at canada.keck@chrr.osu.edu.

Data description

The current Fertility and Relationship History file includes a small set of fertility and relationship items for all respondents for 1979-1981 and a more extensive set of variables for 1982-2022, as well as cross-round (XRND) versions of key variables. These variables include the marriage, relationship and fertility histories of both male and female respondents and the pregnancy histories of the females. The 2022 Fertility and Relationship History file, along with the XRND variables, contains what we believe to be the most accurate information for the female respondents as of that survey point.

Click below to view the program code.

Construction of number of kids and age youngest in HH (2022 and XRND)

PUBLIC RELEASE VARIABLE NAME     PROGRAM VARIABLE NAMES
  HHI_FINAL_AGE.01_2022                age01    
  HHI_FINAL_AGE.02_2022                age02    
  HHI_FINAL_AGE.03_2022                age03    
  HHI_FINAL_AGE.04_2022                age04    
  HHI_FINAL_AGE.05_2022                age05    
  HHI_FINAL_AGE.06_2022                age06    
  HHI_FINAL_AGE.07_2022                age07    
  HHI_FINAL_AGE.08_2022                age08    
  HHI_FINAL_AGE.09_2022                age09    
  HHI_FINAL_AGE.10_2022                age10    
  HHI_FINAL_AGE.11_2022                age11    
  HHI_FINAL_RELCODE.01_2022            rel01    
  HHI_FINAL_RELCODE.02_2022            rel02    
  HHI_FINAL_RELCODE.03_2022            rel03    
  HHI_FINAL_RELCODE.04_2022            rel04    
  HHI_FINAL_RELCODE.05_2022            rel05    
  HHI_FINAL_RELCODE.06_2022            rel06    
  HHI_FINAL_RELCODE.07_2022            rel07    
  HHI_FINAL_RELCODE.08_2022            rel08    
  HHI_FINAL_RELCODE.09_2022            rel09    
  HHI_FINAL_RELCODE.10_2022            rel10    
  HHI_FINAL_RELCODE.11_2022            rel11  
******************************************************
!   begin creation of household record variables for !
!   2022 supplemental fertility file.  These         !
!   variables include number of own children in      !
!   household and age of youngest child in household.!
******************************************************;
******************************************************
!  initialize array for relationship variables       !
******************************************************;
array  rels  rel01 rel02 rel03 rel04 rel05
            rel06 rel07 rel10 rel09 rel10
            rel11;
*******************************************************
!   initialize array for age of household member.     !
*******************************************************;
array  ages  age01 age02 age03 age04 age05
            age06 age07 age10 age09 age10
            age11;
********************************************************
!   create number of own children in household         !
********************************************************;
numch22=0;
do i=1 to dim(rels);
 if rels[i]=2 or rels[i]=3 or rels[i]=20 or rels[i]=21
    or rels[i]=70 or rels[i]=72 then numch22=numch22 + 1;
end;
if rel01=-5  then numch22=-5;
**********************************************************
!   create age of youngest child in household            !
**********************************************************;
ageych22=99;
do i=1 to dim(ages);
 if (rels[i]=2 or rels[i]=3 or rels[i]=20 or rels[i]=21 or rels[i]=70 or rels[i]=72)
     and ages[i]<ageych22  then ageych22=ages[i];
end;
if ageych22>=-3 and ageych22<=-1  then ageych22=-3;
if numch22=0                      then ageych22=-4;
if rel01=-5                      then ageych22=-5;

Construction of age at 1st marriage and mos between 1st marriage and first birth (2022 and XRND)

PUBLIC RELEASE VARIABLE NAMES           PROGRAM VARIABLE NAMES 
 Q1-3_A~M_1979           DOBMO79
 Q1-3_A~Y_1979           NDOBYR79
 C1DOB22~M_2022          C1MOB22
 C1DOB22~Y_2022          C1YOB22
 NUMKID22_2022           NUMKID22
 MOBG1M22_2022           MOBG1M22
 YRBG1M22_2022           YRBG1M22 
/*-----------------------------------*/
/****************************************************************/
/* The following steps create age at first marriage, months 
  between first marriage and first birth, and the flag to tell
  which came first.                                            */
/****************************************************************/
/*This constructs age at first marriage as of 2022*/
AGE1M22=.;
if MOBG1M22=-999 then AGE1M22=-999;
else if MOBG1M22=-5 then AGE1M22=-5;
if AGE1M22=. and MOBG1M22>0 and YRBG1M22>0 and DOBMO79>0 
  and NDOBYR79>0
  then do;
  if MOBG1M22<DOBMO79  then AGE1M22=YRBG1M22-NDOBYR79-1;
  if MOBG1M22>=DOBMO79 then AGE1M22=YRBG1M22-NDOBYR79;
end;
else if AGE1M22=. then do;
 if (MOBG1M22 in (-1 -2 -3)) or (YRBG1M22 in (-1 -2 -3)) then AGE1M22=-3;
end;
/*********************************************************************/
   /*Create months between first marriage and first birth
  MO1M1B  ABSOLUTE VALUE OF MONTHS BETWEEN 1ST MARRIAGE & 1ST
            BIRTH
          -999: MISSING DATE
          -998: NO CHILDREN
          -997: NEVER MARRIED
             0: SAME MONTH
  FL1M1B  FLAG TO INDICATE WHETHER 1ST MARRIAGE OCCURRED BEFORE
            1ST BIRTH
          -999: MISSING DATE
          -998: NO CHILDREN
          -997: NEVER MARRIED    */
/*********************************************************************/
MO1M1B=.;
if C1MOB22>0 and C1YOB22>0 and MOBG1M22>0 and YRBG1M22>0 then 
  MO1M1B=(C1YOB22-YRBG1M22)*12 + (C1MOB22-MOBG1M22);
FL1M1B22=.;
if MO1M1B>=0 then FL1M1B22=1;
if (MO1M1B^=. and MO1M1B<0) then FL1M1B22=0;
MO1M1B22=.;
if MO1M1B>=0 then MO1M1B22=MO1M1B;
if MO1M1B<0 then MO1M1B22=MO1M1B*(-1);
if MO1M1B22=. then do;
if C1YOB22=-5 then MO1M1B22=-5;
else if numkid22=0 then MO1M1B22=-998;
else if YRBG1M22=-999 then MO1M1B22=-997;
else if MO1M1B22=. then MO1M1B22=-999;
end;
if FL1M1B22=. then do;
if C1YOB22=-5 then FL1M1B22=-5;
else if numkid22=0 then FL1M1B22=-998;
else if YRBG1M22=-999 then FL1M1B22=-997;
else if FL1M1B22=. then FL1M1B22=-999;
end;

Construction of Marital History variables (2022 and XRND)

PUBLIC RELEASE VARIABLE NAMES           PROGRAM VARIABLE NAMES 
   CURDATE~Y_2022            CURDATEY   
   Q2-1_2022                 Q2_1       
   Q2-2_2022                 Q2_2       
   Q2-3-0A_2022              NEEDDATE   
   Q2-3-0B~M_2022            MO_MSINCORR
   Q2-3-0B~Y_2022            YR_MSINCORR
   Q2-3A_2022                Q2_3A      
   Q2-4AC_2022               CURMARNOCHG
   Q2-4A_2022                CURMARCHG  
   Q2-5A1B.01_2022           LSTMARREPL1
   Q2-5A1B.02_2022           LSTMARREPL2
   Q2-5A1B.03_2022           LSTMARREPL2
   Q2-5A1.01_2022            CHGL1_SDW  
   Q2-5A1.02_2022            CHGL2_SDW  
   Q2-5A1.03_2022            CHGL3_DRW  
   Q2-5A1_A.01_2022          CHGL1_DRW  
   Q2-5A1_A.02_2022          CHGL2_DRW  
   Q2-5B1.01~M_2022          MOCHG1A    
   Q2-5B1.01~Y_2022          YRCHG1A    
   Q2-5B2.01~M_2022          MOCHG1B    
   Q2-5B2.01~Y_2022          YRCHG1B    
   Q2-5B2.02~M_2022          MOCHG2B    
   Q2-5B2.02~Y_2022          YRCHG2B    
   Q2-5B2.03~M_2022          MOCHG3B    
   Q2-5B2.03~Y_2022          YRCHG3B    
   Q2-5B3.01~M_2022          MOCHG1C    
   Q2-5B3.01~Y_2022          YRCHG1C    
   Q2-5B3.02~M_2022          MOCHG2C    
   Q2-5B3.02~Y_2022          YRCHG2C    
   Q2-5B3.03~M_2022          MOCHG3C    
   Q2-5B3.03~Y_2022          YRCHG3C    
   Q2-5C1.01_2022            ANYCHGAFT1 
   Q2-5C1.02_2022            ANYCHGAFT2 
   Q2-5C1.03_2022            ANYCHGAFT3 
   Q2-5C1BB.01_2022          MSAFTC1    
   Q2-5C1BB.02_2022          MSAFTC2    
   Q2-5C1BB.03_2022          MSAFTC3    
   Q2-5E_2022                Q2_5E      
   Q2-5F_2022                Q2_5F      
   SYMBOL_MARCODE_2022       MARCODE    
   SYMBOL_OLDMARCODE_2022    OLDMARCODE 
   SYMBOL_MARCODEDLI_2022    MARCODEDLI             
   MOBG1M_XRND               MOBG1MMR
   YRBG1M_XRND               YRBG1MMR
   MOEN1M_XRND               MOEN1MMR
   YREN1M_XRND               YREN1MMR
   MOBG2M_XRND               MOBG2MMR
   YRBG2M_XRND               YRBG2MMR
   MOEN2M_XRND               MOEN2MMR
   YREN2M_XRND               YREN2MMR
   MOBG3M_XRND               MOBG3MMR
   YRBG3M_XRND               YRBG3MMR
   MOEN3M_XRND               MOEN3MMR
   YREN3M_XRND               YREN3MMR
   MOBG4M_XRND               MOBG4MMR
   YRBG4M_XRND               YRBG4MMR
   MOEN4M_XRND               MOEN4MMR
   YREN4M_XRND               YREN4MMR
   MOBG5M_XRND               MOBG5MMR
   YRBG5M_XRND               YRBG5MMR
   MOEN5M_XRND               MOEN5MMR
   YREN5M_XRND               YREN5MMR
   MOBG6M_XRND               MOBG6MMR
   YRBG6M_XRND               YRBG6MMR
   MOEN6M_XRND               MOEN6MMR
   YREN6M_XRND               YREN6MMR
   MOBG7M_XRND               MOBG7MMR
   YRBG7M_XRND               YRBG7MMR
   MOEN7M_XRND               MOEN7MMR
   YREN7M_XRND               YREN7MMR
intv2022=1;
if CURDATEY=-5 then intv2022=0;
/*********************************************************/
/* This step initializes variables for the 2022 marriage
  history variables in the FERTILE record.              */
/*********************************************************/
MOBG1M22=.; YRBG1M22=.; MOEN1M22=.; YREN1M22=.; MOBG2M22=.; YRBG2M22=.; MOEN2M22=.;
YREN2M22=.; MOBG3M22=.; YRBG3M22=.; MOEN3M22=.; YREN3M22=.; MOBG4M22=.; YRBG4M22=.; 
MOEN4M22=.; YREN4M22=.; MOBG5M22=.; YRBG5M22=.; MOEN5M22=.; YREN5M22=.; MOBG6M22=.; 
YRBG6M22=.; MOEN6M22=.; YREN6M22=.; MOBG7M22=.; YRBG7M22=.; MOEN7M22=.; YREN7M22=.;
AGE1M22=.;
array marrvars  MOBG1M22 YRBG1M22 MOEN1M22 YREN1M22 MOBG2M22 YRBG2M22 MOEN2M22
               YREN2M22 MOBG3M22 YRBG3M22 MOEN3M22 YREN3M22 MOBG4M22 YRBG4M22 
               MOEN4M22 YREN4M22 MOBG5M22 YRBG5M22 MOEN5M22 YREN5M22 MOBG6M22 
               YRBG6M22 MOEN6M22 YREN6M22 MOBG7M22 YRBG7M22 MOEN7M22 YREN7M22
               AGE1M22;  
do i = 1 to dim(marrvars);
 if intv2022=0 then marrvars[i]=-5;
end;
/*********************************************************/
/* This step sets a no-change flag, and for people with
  no changes sets their 2022 marriage history variables 
  to the values from the historical marriage file.      */
/*********************************************************/
/*Sets a flag equal to one if R says marstat DLI is correct and there have been no changes*/
nochange=0;
if intv2022=0 then nochange=-5;
else if intv2022=1 and Q2_1=1 and Q2_3A=0 then nochange=1;
if nochange=1 then do;
 MOBG1M22=MOBG1MMR; 
 YRBG1M22=YRBG1MMR; 
 MOEN1M22=MOEN1MMR; 
 YREN1M22=YREN1MMR; 
 MOBG2M22=MOBG2MMR; 
 YRBG2M22=YRBG2MMR; 
 MOEN2M22=MOEN2MMR;
 YREN2M22=YREN2MMR; 
 MOBG3M22=MOBG3MMR; 
 YRBG3M22=YRBG3MMR; 
 MOEN3M22=MOEN3MMR; 
 YREN3M22=YREN3MMR; 
 MOBG4M22=MOBG4MMR; 
 YRBG4M22=YRBG4MMR; 
 MOEN4M22=MOEN4MMR; 
 YREN4M22=YREN4MMR; 
 MOBG5M22=MOBG5MMR; 
 YRBG5M22=YRBG5MMR; 
 MOEN5M22=MOEN5MMR; 
 YREN5M22=YREN5MMR; 
 MOBG6M22=MOBG6MMR; 
 YRBG6M22=YRBG6MMR; 
 MOEN6M22=MOEN6MMR; 
 YREN6M22=YREN6MMR; 
 MOBG7M22=MOBG7MMR; 
 YRBG7M22=YRBG7MMR;
 MOEN7M22=MOEN7MMR; 
 YREN7M22=YREN7MMR; 
end;
/*********************************************************/
/* This step creates flags for types of changes made     */
/*********************************************************/
/*Sets a flag equal to one if R says marstat DLI is incorrect but there have been no
 changes after correcting marital status*/
erroronly=0;
if intv2022=0 then erroronly=-5;
else if intv2022=1 and Q2_1=0 and Q2_3A=0 then erroronly=1;
/*Sets a flag equal to one if R says marstat DLi is correct but there have been changes*/
changeonly=0;
if intv2022=0 then changeonly=-5;
else if intv2022=1 and Q2_1=1 and Q2_3A=1 then changeonly=1;
/*Sets a flag equal to one if R says marstat DLI is incorrect and that there have been 
 changes after correcting marital status*/
errorandchange=0;
if intv2022=0 then errorandchange=-5;
else if intv2022=1 and Q2_1=0 and Q2_3A=1 then errorandchange=1;
/*This is just a check to make sure the universes are unique and no one got flagged twice*/
total=-5;
if intv2022=1 then total=erroronly+changeonly+errorandchange;
/*******************************************************************/
/* This step creates flag for where changes should be slotted. 
  Values for flag are as follows:
  1 = never married
  2 = beginning of 1st marriage
  3 = end of 1st marriage
  4 = beginning of 2nd marriage
  5 = end of 2nd marriage
  6 = beginning of 3rd marriage
  7 = end of 3rd marriage  
  8 = beginning of 4th marriage
  9 = end of 4th marriage  
 10 = beginning of 5th marriage
 11 = end of 5th marriage  
 12 = beginning of 6th marriage
 13 = end of 6th marriage  
 14 = beginning of 7th marriage                                   */
/*******************************************************************/
msli22=0;
if intv2022=0 then msli22=-5;
else if nochange=1 then msli22=-4;
else if total=1 then do;
 if MOBG7MMR=-999 then msli22=1;
 else if MOBG7MMR=-998 then msli22=2;
 else if MOBG7MMR=-997 then msli22=3;
 else if MOBG7MMR=-996 then msli22=4;
 else if MOBG7MMR=-995 then msli22=5;
 else if MOBG7MMR=-994 then msli22=6;
 else if MOBG7MMR=-993 then msli22=7;
 else if MOBG7MMR=-992 then msli22=8;
 else if MOBG7MMR=-991 then msli22= 9;
 else if MOBG7MMR=-990 then msli22=10;
 else if MOBG7MMR=-989 then msli22=11;
 else if MOBG7MMR=-988 then msli22=12;
 else if MOBG7MMR=-987 then msli22=13;
 else if MOBG7MMR>-4 then msli22=14;
end;
/********************************************************************/
/* This step sets up a count variable of number of changes made.    */
/********************************************************************/
numchange=0;
if intv2022=0 then numchange=-5;
array changes  MARRCHG122 MARRCHG222 MARRCHG322;
do i = 1 to 3;
 if changes[i]>=-2 then numchange=numchange+1;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were never married at dli and who report only changes.       */
/********************************************************************/
if msli22=1 and changeonly=1 then do;
  if numchange=1 then do;
     MOBG1M22=MARRCHG1MO; 
     YRBG1M22=MARRCHG1YR; 
     MOEN1M22=-998; 
     YREN1M22=-998; 
     MOBG2M22=-998; 
     YRBG2M22=-998; 
     MOEN2M22=-998;
     YREN2M22=-998; 
     MOBG3M22=-998; 
     YRBG3M22=-998; 
     MOEN3M22=-998; 
     YREN3M22=-998; 
     MOBG4M22=-998; 
     YRBG4M22=-998; 
     MOEN4M22=-998; 
     YREN4M22=-998; 
     MOBG5M22=-998; 
     YRBG5M22=-998; 
     MOEN5M22=-998; 
     YREN5M22=-998; 
     MOBG6M22=-998; 
     YRBG6M22=-998; 
     MOEN6M22=-998; 
     YREN6M22=-998; 
     MOBG7M22=-998; 
     YRBG7M22=-998;
     MOEN7M22=-998; 
     YREN7M22=-998; 
  end;
  else if numchange=2 then do;
     MOBG1M22=MARRCHG1MO; 
     YRBG1M22=MARRCHG1YR; 
     MOEN1M22=MARRCHG2MO; 
     YREN1M22=MARRCHG2YR; 
     MOBG2M22=-997; 
     YRBG2M22=-997; 
     MOEN2M22=-997;
     YREN2M22=-997; 
     MOBG3M22=-997; 
     YRBG3M22=-997; 
     MOEN3M22=-997; 
     YREN3M22=-997; 
     MOBG4M22=-997; 
     YRBG4M22=-997; 
     MOEN4M22=-997; 
     YREN4M22=-997; 
     MOBG5M22=-997; 
     YRBG5M22=-997; 
     MOEN5M22=-997; 
     YREN5M22=-997; 
     MOBG6M22=-997; 
     YRBG6M22=-997; 
     MOEN6M22=-997; 
     YREN6M22=-997; 
     MOBG7M22=-997; 
     YRBG7M22=-997;
     MOEN7M22=-997; 
     YREN7M22=-997; 
  end;
  else if numchange=3 then do;
     MOBG1M22=MARRCHG1MO; 
     YRBG1M22=MARRCHG1YR; 
     MOEN1M22=MARRCHG2MO; 
     YREN1M22=MARRCHG2YR; 
     MOBG2M22=MARRCHG3MO; 
     YRBG2M22=MARRCHG3YR; 
     MOEN2M22=-996;
     YREN2M22=-996; 
     MOBG3M22=-996; 
     YRBG3M22=-996; 
     MOEN3M22=-996; 
     YREN3M22=-996; 
     MOBG4M22=-996; 
     YRBG4M22=-996; 
     MOEN4M22=-996; 
     YREN4M22=-996; 
     MOBG5M22=-996; 
     YRBG5M22=-996; 
     MOEN5M22=-996; 
     YREN5M22=-996; 
     MOBG6M22=-996; 
     YRBG6M22=-996; 
     MOEN6M22=-996; 
     YREN6M22=-996; 
     MOBG7M22=-996; 
     YRBG7M22=-996;
     MOEN7M22=-996; 
     YREN7M22=-996; 
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were in their first marriage at dli and who report only 
  changes.                                                         */
/********************************************************************/
if msli22=2 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (2 4) then do; /*Separated or reunited*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR; 
        YRBG5M22=YRBG5MMR; 
        MOEN5M22=MOEN5MMR; 
        YREN5M22=YREN5MMR; 
        MOBG6M22=MOBG6MMR; 
        YRBG6M22=YRBG6MMR; 
        MOEN6M22=MOEN6MMR; 
        YREN6M22=YREN6MMR; 
        MOBG7M22=MOBG7MMR; 
        YRBG7M22=YRBG7MMR;
        MOEN7M22=MOEN7MMR; 
        YREN7M22=YREN7MMR; 
     end;
     else if MARRCHG122 in (3 6) then do; /*Divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MARRCHG1MO; 
        YREN1M22=MARRCHG1YR; 
        MOBG2M22=-997; 
        YRBG2M22=-997; 
        MOEN2M22=-997;
        YREN2M22=-997; 
        MOBG3M22=-997; 
        YRBG3M22=-997; 
        MOEN3M22=-997; 
        YREN3M22=-997; 
        MOBG4M22=-997; 
        YRBG4M22=-997; 
        MOEN4M22=-997; 
        YREN4M22=-997; 
        MOBG5M22=-997; 
        YRBG5M22=-997; 
        MOEN5M22=-997; 
        YREN5M22=-997; 
        MOBG6M22=-997; 
        YRBG6M22=-997; 
        MOEN6M22=-997; 
        YREN6M22=-997; 
        MOBG7M22=-997; 
        YRBG7M22=-997;
        MOEN7M22=-997; 
        YREN7M22=-997; 
     end;
  end;
  else if numchange=2 then do;
     if (MARRCHG122=2 or MARRCHG122=4) and (MARRCHG222=2 or MARRCHG222=4)  
     then do; /*Separated or reunited to separated or reunited*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR; 
        YRBG5M22=YRBG5MMR; 
        MOEN5M22=MOEN5MMR; 
        YREN5M22=YREN5MMR; 
        MOBG6M22=MOBG6MMR; 
        YRBG6M22=YRBG6MMR; 
        MOEN6M22=MOEN6MMR; 
        YREN6M22=YREN6MMR; 
        MOBG7M22=MOBG7MMR; 
        YRBG7M22=YRBG7MMR;
        MOEN7M22=MOEN7MMR; 
        YREN7M22=YREN7MMR; 
     end;
     else if (MARRCHG122=2 or MARRCHG122=4) and (MARRCHG222=3 or MARRCHG222=6)
     then do; /*Separated or reunited to divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MARRCHG2MO; 
        YREN1M22=MARRCHG2YR; 
        MOBG2M22=-997; 
        YRBG2M22=-997; 
        MOEN2M22=-997;
        YREN2M22=-997; 
        MOBG3M22=-997; 
        YRBG3M22=-997; 
        MOEN3M22=-997; 
        YREN3M22=-997; 
        MOBG4M22=-997; 
        YRBG4M22=-997; 
        MOEN4M22=-997; 
        YREN4M22=-997; 
        MOBG5M22=-997; 
        YRBG5M22=-997; 
        MOEN5M22=-997; 
        YREN5M22=-997; 
        MOBG6M22=-997; 
        YRBG6M22=-997; 
        MOEN6M22=-997; 
        YREN6M22=-997; 
        MOBG7M22=-997; 
        YRBG7M22=-997;
        MOEN7M22=-997; 
        YREN7M22=-997; 
     end;
     else if (MARRCHG122=3 or MARRCHG122=6) and (MARRCHG222=5)
     then do; /*Divorced or widowed to remarried*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MARRCHG1MO; 
        YREN1M22=MARRCHG1YR; 
        MOBG2M22=MARRCHG2MO; 
        YRBG2M22=MARRCHG2YR; 
        MOEN2M22=-996;
        YREN2M22=-996; 
        MOBG3M22=-996; 
        YRBG3M22=-996; 
        MOEN3M22=-996; 
        YREN3M22=-996; 
        MOBG4M22=-996; 
        YRBG4M22=-996; 
        MOEN4M22=-996; 
        YREN4M22=-996; 
        MOBG5M22=-996; 
        YRBG5M22=-996; 
        MOEN5M22=-996; 
        YREN5M22=-996; 
        MOBG6M22=-996; 
        YRBG6M22=-996; 
        MOEN6M22=-996; 
        YREN6M22=-996; 
        MOBG7M22=-996; 
        YRBG7M22=-996;
        MOEN7M22=-996; 
        YREN7M22=-996; 
     end;
  end;
end;      
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were at the end of their first marriage at dli and who report 
  only changes.                                                    */
/********************************************************************/
if msli22=3 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122=5 or MARRCHG122=1 then do; /*Remarried/married*/
        MOBG1M22=MOBG1MMR;                    
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MARRCHG1MO; 
        YRBG2M22=MARRCHG1YR; 
        MOEN2M22=-996;
        YREN2M22=-996; 
        MOBG3M22=-996; 
        YRBG3M22=-996; 
        MOEN3M22=-996; 
        YREN3M22=-996; 
        MOBG4M22=-996; 
        YRBG4M22=-996; 
        MOEN4M22=-996; 
        YREN4M22=-996; 
        MOBG5M22=-996; 
        YRBG5M22=-996; 
        MOEN5M22=-996; 
        YREN5M22=-996; 
        MOBG6M22=-996; 
        YRBG6M22=-996; 
        MOEN6M22=-996; 
        YREN6M22=-996; 
        MOBG7M22=-996; 
        YRBG7M22=-996;
        MOEN7M22=-996; 
        YREN7M22=-996; 
     end;
  end;
  else if numchange=2 then do;
     if (MARRCHG122=5 or MARRCHG122=1) and MARRCHG222=2 then do; /*Remarried/married to separated*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MARRCHG1MO; 
        YRBG2M22=MARRCHG1YR; 
        MOEN2M22=-996;
        YREN2M22=-996; 
        MOBG3M22=-996; 
        YRBG3M22=-996; 
        MOEN3M22=-996; 
        YREN3M22=-996; 
        MOBG4M22=-996; 
        YRBG4M22=-996; 
        MOEN4M22=-996; 
        YREN4M22=-996; 
        MOBG5M22=-996; 
        YRBG5M22=-996; 
        MOEN5M22=-996; 
        YREN5M22=-996; 
        MOBG6M22=-996; 
        YRBG6M22=-996; 
        MOEN6M22=-996; 
        YREN6M22=-996; 
        MOBG7M22=-996; 
        YRBG7M22=-996;
        MOEN7M22=-996; 
        YREN7M22=-996; 
      end;
     if (MARRCHG122=5 or MARRCHG122=1) and MARRCHG222=3 then do; /*Remarried/married to divorced*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MARRCHG1MO; 
        YRBG2M22=MARRCHG1YR; 
        MOEN2M22=MARRCHG2MO;
        YREN2M22=MARRCHG2YR; 
        MOBG3M22=-995; 
        YRBG3M22=-995; 
        MOEN3M22=-995; 
        YREN3M22=-995; 
        MOBG4M22=-995; 
        YRBG4M22=-995; 
        MOEN4M22=-995; 
        YREN4M22=-995; 
        MOBG5M22=-995; 
        YRBG5M22=-995; 
        MOEN5M22=-995; 
        YREN5M22=-995; 
        MOBG6M22=-995; 
        YRBG6M22=-995; 
        MOEN6M22=-995; 
        YREN6M22=-995; 
        MOBG7M22=-995; 
        YRBG7M22=-995;
        MOEN7M22=-995; 
        YREN7M22=-995; 
      end;
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were in their second marriage at dli and who report only 
  changes.                                                         */
/********************************************************************/
if msli22=4 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (2 4) then do; /*Separated or reunited - nothing really changed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR; 
        YRBG5M22=YRBG5MMR; 
        MOEN5M22=MOEN5MMR; 
        YREN5M22=YREN5MMR; 
        MOBG6M22=MOBG6MMR; 
        YRBG6M22=YRBG6MMR; 
        MOEN6M22=MOEN6MMR; 
        YREN6M22=YREN6MMR; 
        MOBG7M22=MOBG7MMR; 
        YRBG7M22=YRBG7MMR;
        MOEN7M22=MOEN7MMR; 
        YREN7M22=YREN7MMR; 
     end;
     else if MARRCHG122 in (3 6) then do; /*Divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MARRCHG1MO;
        YREN2M22=MARRCHG1YR; 
        MOBG3M22=-995; 
        YRBG3M22=-995; 
        MOEN3M22=-995; 
        YREN3M22=-995; 
        MOBG4M22=-995; 
        YRBG4M22=-995; 
        MOEN4M22=-995; 
        YREN4M22=-995; 
        MOBG5M22=-995; 
        YRBG5M22=-995; 
        MOEN5M22=-995; 
        YREN5M22=-995; 
        MOBG6M22=-995; 
        YRBG6M22=-995; 
        MOEN6M22=-995; 
        YREN6M22=-995; 
        MOBG7M22=-995; 
        YRBG7M22=-995;
        MOEN7M22=-995; 
        YREN7M22=-995;
     end;
   end;
   else if numchange=2 then do;
     if (MARRCHG122=2 or MARRCHG122=4) and (MARRCHG222=3 or MARRCHG222=6)
     then do; /*Separated or reunited to divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MARRCHG2MO;
        YREN2M22=MARRCHG2YR; 
        MOBG3M22=-995; 
        YRBG3M22=-995; 
        MOEN3M22=-995; 
        YREN3M22=-995; 
        MOBG4M22=-995; 
        YRBG4M22=-995; 
        MOEN4M22=-995; 
        YREN4M22=-995; 
        MOBG5M22=-995; 
        YRBG5M22=-995; 
        MOEN5M22=-995; 
        YREN5M22=-995; 
        MOBG6M22=-995; 
        YRBG6M22=-995; 
        MOEN6M22=-995; 
        YREN6M22=-995; 
        MOBG7M22=-995; 
        YRBG7M22=-995;
        MOEN7M22=-995; 
        YREN7M22=-995;
     end;
     else if (MARRCHG122=3 or MARRCHG122=6) and (MARRCHG222=5)
     then do; /*Divorced or widowed to remarried*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MARRCHG1MO;
        YREN2M22=MARRCHG1YR; 
        MOBG3M22=MARRCHG2MO; 
        YRBG3M22=MARRCHG2YR; 
        MOEN3M22=-994; 
        YREN3M22=-994; 
        MOBG4M22=-994; 
        YRBG4M22=-994; 
        MOEN4M22=-994; 
        YREN4M22=-994; 
        MOBG5M22=-994; 
        YRBG5M22=-994; 
        MOEN5M22=-994; 
        YREN5M22=-994; 
        MOBG6M22=-994; 
        YRBG6M22=-994; 
        MOEN6M22=-994; 
        YREN6M22=-994; 
        MOBG7M22=-994; 
        YRBG7M22=-994;
        MOEN7M22=-994; 
        YREN7M22=-994;
     end;
   end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were at the end of their second marriage at dli and who  
  report only changes.                                             */
/********************************************************************/
if msli22=5 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122=5 or MARRCHG122=1 then do; /*Remarried/married */
        MOBG1M22=MOBG1MMR;                    
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR;
        YRBG2M22=YRBG2MMR;
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MARRCHG1MO; 
        YRBG3M22=MARRCHG1YR; 
        MOEN3M22=-994; 
        YREN3M22=-994; 
        MOBG4M22=-994; 
        YRBG4M22=-994; 
        MOEN4M22=-994; 
        YREN4M22=-994; 
        MOBG5M22=-994; 
        YRBG5M22=-994; 
        MOEN5M22=-994; 
        YREN5M22=-994; 
        MOBG6M22=-994; 
        YRBG6M22=-994; 
        MOEN6M22=-994; 
        YREN6M22=-994; 
        MOBG7M22=-994; 
        YRBG7M22=-994;
        MOEN7M22=-994; 
        YREN7M22=-994;
     end;
  end;
  else if numchange=2 then do;
     if (MARRCHG122=5 or MARRCHG122=1) and MARRCHG222=2 then do; /*Remarried/married to separated*/
        MOBG1M22=MOBG1MMR;                    
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR;
        YRBG2M22=YRBG2MMR;
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MARRCHG1MO; 
        YRBG3M22=MARRCHG1YR; 
        MOEN3M22=-994; 
        YREN3M22=-994; 
        MOBG4M22=-994; 
        YRBG4M22=-994; 
        MOEN4M22=-994; 
        YREN4M22=-994; 
        MOBG5M22=-994; 
        YRBG5M22=-994; 
        MOEN5M22=-994; 
        YREN5M22=-994; 
        MOBG6M22=-994; 
        YRBG6M22=-994; 
        MOEN6M22=-994; 
        YREN6M22=-994; 
        MOBG7M22=-994; 
        YRBG7M22=-994;
        MOEN7M22=-994; 
        YREN7M22=-994;
     end;
     if (MARRCHG122=5 or MARRCHG122=1) and MARRCHG222=3 then do; /*Remarried/married to divorced*/
        MOBG1M22=MOBG1MMR;                    
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR;
        YRBG2M22=YRBG2MMR;
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MARRCHG1MO; 
        YRBG3M22=MARRCHG1YR; 
        MOEN3M22=MARRCHG2MO; 
        YREN3M22=MARRCHG2YR; 
        MOBG4M22=-993; 
        YRBG4M22=-993; 
        MOEN4M22=-993; 
        YREN4M22=-993; 
        MOBG5M22=-993; 
        YRBG5M22=-993; 
        MOEN5M22=-993; 
        YREN5M22=-993; 
        MOBG6M22=-993; 
        YRBG6M22=-993; 
        MOEN6M22=-993; 
        YREN6M22=-993; 
        MOBG7M22=-993; 
        YRBG7M22=-993;
        MOEN7M22=-993; 
        YREN7M22=-993;
     end;
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were in their third marriage at dli and who report only 
  changes.                                                         */
/********************************************************************/
if msli22=6 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (2 4) then do; /*Separated or reunited - nothing really changed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR; 
        YRBG5M22=YRBG5MMR; 
        MOEN5M22=MOEN5MMR; 
        YREN5M22=YREN5MMR; 
        MOBG6M22=MOBG6MMR; 
        YRBG6M22=YRBG6MMR; 
        MOEN6M22=MOEN6MMR; 
        YREN6M22=YREN6MMR; 
        MOBG7M22=MOBG7MMR; 
        YRBG7M22=YRBG7MMR;
        MOEN7M22=MOEN7MMR; 
        YREN7M22=YREN7MMR; 
     end;
     else if MARRCHG122 in (3 6) then do; /*Divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MARRCHG1MO; 
        YREN3M22=MARRCHG1YR; 
        MOBG4M22=-993; 
        YRBG4M22=-993; 
        MOEN4M22=-993; 
        YREN4M22=-993; 
        MOBG5M22=-993; 
        YRBG5M22=-993; 
        MOEN5M22=-993; 
        YREN5M22=-993; 
        MOBG6M22=-993; 
        YRBG6M22=-993; 
        MOEN6M22=-993; 
        YREN6M22=-993; 
        MOBG7M22=-993; 
        YRBG7M22=-993;
        MOEN7M22=-993; 
        YREN7M22=-993;
     end;
   end;
   else if numchange=2 then do;
     if (MARRCHG122=2 or MARRCHG122=4) and (MARRCHG222=3 or MARRCHG222=6)
     then do; /*Separated or reunited to divorced or widowed*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MARRCHG1MO; 
        YREN3M22=MARRCHG1YR; 
        MOBG4M22=-993; 
        YRBG4M22=-993; 
        MOEN4M22=-993; 
        YREN4M22=-993; 
        MOBG5M22=-993; 
        YRBG5M22=-993; 
        MOEN5M22=-993; 
        YREN5M22=-993; 
        MOBG6M22=-993; 
        YRBG6M22=-993; 
        MOEN6M22=-993; 
        YREN6M22=-993; 
        MOBG7M22=-993; 
        YRBG7M22=-993;
        MOEN7M22=-993; 
        YREN7M22=-993;
     end;
     else if (MARRCHG122=3 or MARRCHG122=6) and (MARRCHG222=5)
     then do; /*Divorced or widowed to remarried*/
        MOBG1M22=MOBG1MMR; 
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR; 
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MARRCHG1MO; 
        YREN3M22=MARRCHG1YR; 
        MOBG4M22=MARRCHG2MO; 
        YRBG4M22=MARRCHG2YR; 
        MOEN4M22=-992; 
        YREN4M22=-992; 
        MOBG5M22=-992; 
        YRBG5M22=-992; 
        MOEN5M22=-992; 
        YREN5M22=-992; 
        MOBG6M22=-992; 
        YRBG6M22=-992; 
        MOEN6M22=-992; 
        YREN6M22=-992; 
        MOBG7M22=-992; 
        YRBG7M22=-992;
        MOEN7M22=-992; 
        YREN7M22=-992;
     end;
   end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were at the end of their third marriage at dli and who  
  report only changes.                                             */
/********************************************************************/
if msli22=7 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122=5 or MARRCHG122=1 then do; /*Remarried/married */
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MARRCHG1MO; 
        YRBG4M22=MARRCHG1YR; 
        MOEN4M22=-992; 
        YREN4M22=-992; 
        MOBG5M22=-992; 
        YRBG5M22=-992; 
        MOEN5M22=-992; 
        YREN5M22=-992; 
        MOBG6M22=-992; 
        YRBG6M22=-992; 
        MOEN6M22=-992; 
        YREN6M22=-992; 
        MOBG7M22=-992; 
        YRBG7M22=-992;
        MOEN7M22=-992; 
        YREN7M22=-992;
     end;
  end;
  else if numchange=2 then do; 
     if (MARRCHG122=5 or MARRCHG122=1) and (MARRCHG222=3 or MARRCHG222=6)
     then do; /*Remarried/married to divorced/widowed*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MARRCHG1MO; 
        YRBG4M22=MARRCHG1YR; 
        MOEN4M22=MARRCHG2MO; 
        YREN4M22=MARRCHG2YR; 
        MOBG5M22=-991; 
        YRBG5M22=-991; 
        MOEN5M22=-991; 
        YREN5M22=-991; 
        MOBG6M22=-991; 
        YRBG6M22=-991; 
        MOEN6M22=-991; 
        YREN6M22=-991; 
        MOBG7M22=-991; 
        YRBG7M22=-991;
        MOEN7M22=-991; 
        YREN7M22=-991;
     end;
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were in their fourth marriage at dli and who report only 
  changes.                                                         */
/********************************************************************/
if msli22=8 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (2 4) then do; /*separated/reunited - nothing changed*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=-992; 
        YREN4M22=-992; 
        MOBG5M22=-992; 
        YRBG5M22=-992; 
        MOEN5M22=-992; 
        YREN5M22=-992; 
        MOBG6M22=-992; 
        YRBG6M22=-992; 
        MOEN6M22=-992; 
        YREN6M22=-992; 
        MOBG7M22=-992; 
        YRBG7M22=-992;
        MOEN7M22=-992; 
        YREN7M22=-992;
     end;
     else if MARRCHG122 in (3 6) then do; /*Divorced or widowed*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MARRCHG1MO; 
        YREN4M22=MARRCHG1YR; 
        MOBG5M22=-991; 
        YRBG5M22=-991; 
        MOEN5M22=-991; 
        YREN5M22=-991; 
        MOBG6M22=-991; 
        YRBG6M22=-991; 
        MOEN6M22=-991; 
        YREN6M22=-991; 
        MOBG7M22=-991; 
        YRBG7M22=-991;
        MOEN7M22=-991; 
        YREN7M22=-991;
     end;
  end;
  else if numchange=2 then do;
     if MARRCHG122 in (3 6) and MARRCHG222 in (5) then do; /*Divorced or widowed to remarried*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MARRCHG1MO; 
        YREN4M22=MARRCHG1YR; 
        MOBG5M22=MARRCHG2MO; 
        YRBG5M22=MARRCHG2YR; 
        MOEN5M22=-990; 
        YREN5M22=-990; 
        MOBG6M22=-990; 
        YRBG6M22=-990; 
        MOEN6M22=-990; 
        YREN6M22=-990; 
        MOBG7M22=-990; 
        YRBG7M22=-990;
        MOEN7M22=-990; 
        YREN7M22=-990;
     end;
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were at the end of their fourth marriage at dli and who 
  report only changes.                                             */
/********************************************************************/
if msli22=9 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (5) then do; /*Remarried*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MARRCHG1MO; 
        YRBG5M22=MARRCHG1YR; 
        MOEN5M22=-990; 
        YREN5M22=-990; 
        MOBG6M22=-990; 
        YRBG6M22=-990; 
        MOEN6M22=-990; 
        YREN6M22=-990; 
        MOBG7M22=-990; 
        YRBG7M22=-990;
        MOEN7M22=-990; 
        YREN7M22=-990;
     end;
  end;
end;
/********************************************************************/
/* This step creates 2022 marital history variables for respondents
  who were at the beginning of their 5th marriage at dli and who 
  report only changes.                                             */
/********************************************************************/
if msli22=10 and changeonly=1 then do;
  if numchange=1 then do;
     if MARRCHG122 in (2 4) then do; /*separated/reunited - nothing changed*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR; 
        YRBG5M22=YRBG5MMR; 
        MOEN5M22=-992; 
        YREN5M22=-992; 
        MOBG6M22=-992; 
        YRBG6M22=-992; 
        MOEN6M22=-992; 
        YREN6M22=-992; 
        MOBG7M22=-992; 
        YRBG7M22=-992;
        MOEN7M22=-992; 
        YREN7M22=-992;
     end;
     else if MARRCHG122 in (3 6) then do; /*Divorced or widowed*/
        MOBG1M22=MOBG1MMR;                   
        YRBG1M22=YRBG1MMR; 
        MOEN1M22=MOEN1MMR; 
        YREN1M22=YREN1MMR; 
        MOBG2M22=MOBG2MMR; 
        YRBG2M22=YRBG2MMR; 
        MOEN2M22=MOEN2MMR;
        YREN2M22=YREN2MMR;
        MOBG3M22=MOBG3MMR; 
        YRBG3M22=YRBG3MMR; 
        MOEN3M22=MOEN3MMR; 
        YREN3M22=YREN3MMR; 
        MOBG4M22=MOBG4MMR; 
        YRBG4M22=YRBG4MMR; 
        MOEN4M22=MOEN4MMR; 
        YREN4M22=YREN4MMR; 
        MOBG5M22=MOBG5MMR;
        YRBG5M22=YRBG5MMR;
        MOEN5M22=MARRCHG1MO; 
        YREN5M22=MARRCHG1YR; 
        MOBG6M22=-989; 
        YRBG6M22=-989; 
        MOEN6M22=-989; 
        YREN6M22=-989; 
        MOBG7M22=-989; 
        YRBG7M22=-989;
        MOEN7M22=-989; 
        YREN7M22=-989;
     end;
  end;
end;

Construction of Relationship History variables (XRND)

PUBLIC RELEASE VARIABLE NAMES                     PROGRAM VARIABLE NAMES 
 SAMPLE_SEX_1979                  RSEX       
 HHI_FINAL_GENCODE.01_2022        HH1GENCODE 
 HHI_FINAL_GENCODE.02_2022        HH2GENCODE 
 HHI_FINAL_GENCODE.03_2022        HH3GENCODE 
 HHI_FINAL_GENCODE.04_2022        HH4GENCODE 
 HHI_FINAL_GENCODE.05_2022        HH5GENCODE 
 HHI_FINAL_GENCODE.06_2022        HH6GENCODE 
 HHI_FINAL_GENCODE.07_2022        HH7GENCODE 
 HHI_FINAL_GENCODE.08_2022        HH8GENCODE 
 HHI_FINAL_GENCODE.09_2022        HH9GENCODE 
 HHI_FINAL_GENCODE.10_2022        HH10GENCODE
 HHI_FINAL_GENCODE.11_2022        HH11GENCODE
 HHI_FINAL_AGE.01_2022            HH1AGE     
 HHI_FINAL_AGE.02_2022            HH2AGE     
 HHI_FINAL_AGE.03_2022            HH3AGE     
 HHI_FINAL_AGE.04_2022            HH4AGE     
 HHI_FINAL_AGE.05_2022            HH5AGE     
 HHI_FINAL_AGE.06_2022            HH6AGE     
 HHI_FINAL_AGE.07_2022            HH7AGE     
 HHI_FINAL_AGE.08_2022            HH8AGE     
 HHI_FINAL_AGE.09_2022            HH9AGE     
 HHI_FINAL_AGE.10_2022            HH10AGE    
 HHI_FINAL_AGE.11_2022            HH11AGE    
 HHI_FINAL_RELCODE.01_2022        HH1RELCODE 
 HHI_FINAL_RELCODE.02_2022        HH2RELCODE 
 HHI_FINAL_RELCODE.03_2022        HH3RELCODE 
 HHI_FINAL_RELCODE.04_2022        HH4RELCODE 
 HHI_FINAL_RELCODE.05_2022        HH5RELCODE 
 HHI_FINAL_RELCODE.06_2022        HH6RELCODE 
 HHI_FINAL_RELCODE.07_2022        HH7RELCODE 
 HHI_FINAL_RELCODE.08_2022        HH8RELCODE 
 HHI_FINAL_RELCODE.09_2022        HH9RELCODE 
 HHI_FINAL_RELCODE.10_2022        HH10RELCODE
 HHI_FINAL_RELCODE.11_2022        HH11RELCODE
/*---------------------------------------------------*/
/* Additional variables used:
  PASAMESEX=flag indicating respondent has a same
  sex partner in 2022
   
  NUMSPPTRDLI=the number of spouse/partners as of the 
  respondent's date of last interview
  
  RELSPPTRDLI=the relationship code from the 
  respondent's date of last interview 
  
  LASTINT=year of respondent's last interview 
  prior to 2022
  
  All spouse/partner names from all survey rounds   */
/*---------------------------------------------------*/
/*****************************************************/
/* Code to create flags for variable creation        */
/*****************************************************/
array relc  HH1RELCODE HH2RELCODE HH3RELCODE HH4RELCODE HH5RELCODE  
           HH6RELCODE HH7RELCODE HH8RELCODE HH9RELCODE HH10RELCODE
           HH11RELCODE HH12RELCODE HH13RELCODE HH14RELCODE;
           
array names  HH1NAME HH2NAME HH3NAME HH4NAME HH5NAME HH6NAME HH7NAME  
            HH8NAME HH9NAME HH10NAME HH11NAME HH12NAME HH13NAME
            HH14NAME;
numspouse=0;
do i=1 to dim(relc);
  if relc[i]=1 then numspouse=numspouse+1;
end;            
numptr=0;
do i=1 to dim(relc);
  if relc[i]=33 then numptr=numptr+1;
end;            
haszeros=0;
do i = 1 to dim(relc);
 if relc[i]=0 then haszeros=1;
end;
length spptrname $40;
hasspptr=0;
spptrtype=0;
slotnum3=0;
do i = 1 to dim(relc);
 if relc[i] in (1 33) then do;
    hasspptr=hasspptr+1;
    spptrtype=relc[i];
    slotnum3=i;
    spptrname=names[i];
 end;
end;
hasononrel=0;
slotnum2=0;
do i = 1 to dim(relc);
 if relc[i]=36 then do;
    hasononrel=hasononrel+1;
    slotnum2=i;
 end;
end;
haspossible=0;
slotnum=0;
do i = 1 to dim(relc);
 if relc[i] in (57 58) then do;
   haspossible=haspossible+1;
   slotnum=i;
 end;
end;
spptrname=UPCASE(spptrname);
if intv2022=0 then do;
  hasspptr=-5; 
  spptrtype=-5;
  hasononrel=-5;
end;
if spptrtype=33 and PASAMESEX=1 then spptrtype=75;
/**************************************************/
/* Begin construction of spouse/partner variables */
/**************************************************/
NUMSPPTR22=.;
RELSPPTR22=.;
/*Set noninterviews to valid skips*/
if intv2022=0 then do;
  NUMSPPTR22=-4;
  RELSPPTR22=-4;
end;
/*Set people with no current spouse/partner in 2022 and at DLI to have same data as DLI*/ 
if NUMSPPTR22=. and hasspptr=0 and RELSPPTRDLI in (-999 0) then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set people with no current spouse/partner but who had one DLI*/
if NUMSPPTR22=. and hasspptr=0 and RELSPPTRDLI in (1 33 36) then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=0;
end;
/*Set variables for people reporting first spouse/partner*/
if NUMSPPTR22=. and hasspptr=1 and RELSPPTRDLI=-999 then do;
  NUMSPPTR22=1;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2020*/
/*********************************************************************/
samecode20=0;
samename20=0;
if LASTINT=2020 then do;
  if spptrtype=RELSPPTRDLI then samecode20=1;
  if spptrname=name20 then samename20=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2020 and 2022*/
if NUMSPPTR22=. and LASTINT=2020 and samecode20=1 and samename20=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2020 and 2022*/
if NUMSPPTR22=. and LASTINT=2020 and samecode20=0 and samename20=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2018*/
/*********************************************************************/
samecode18=0;
samename18=0;
if LASTINT=2018 then do;
  if spptrtype=RELSPPTRDLI then samecode18=1;
  if spptrname=name18 then samename18=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2018 and 2022*/
if NUMSPPTR22=. and LASTINT=2018 and samecode18=1 and samename18=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2018 and 2022*/
if NUMSPPTR22=. and LASTINT=2018 and samecode18=0 and samename18=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2016*/
/*********************************************************************/
samecode16=0;
samename16=0;
if LASTINT=2016 then do;
  if spptrtype=RELSPPTRDLI then samecode16=1;
  if spptrname=name16 then samename16=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2016 and 2022*/
if NUMSPPTR22=. and LASTINT=2016 and samecode16=1 and samename16=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2016 and 2022*/
if NUMSPPTR22=. and LASTINT=2016 and samecode16=0 and samename16=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2014*/
/*********************************************************************/
samecode14=0;
samename14=0;
if LASTINT=2014 then do;
  if spptrtype=RELSPPTRDLI then samecode14=1;
  if spptrname=name14 then samename14=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2014 and 2022*/
if NUMSPPTR22=. and LASTINT=2014 and samecode14=1 and samename14=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2014 and 2022*/
if NUMSPPTR22=. and LASTINT=2014 and samecode14=0 and samename14=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2012*/
/*********************************************************************/
samecode12=0;
samename12=0;
if LASTINT=2012 then do;
  if spptrtype=RELSPPTRDLI then samecode12=1;
  if spptrname=name12 then samename12=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2012 and 2022*/
if NUMSPPTR22=. and LASTINT=2012 and samecode12=1 and samename12=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2012 and 2022*/
if NUMSPPTR22=. and LASTINT=2012 and samecode12=0 and samename12=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2010*/
/*********************************************************************/
samecode10=0;
samename10=0;
if LASTINT=2010 then do;
  if spptrtype=RELSPPTRDLI then samecode10=1;
  if spptrname=name10 then samename10=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2010 and 2022*/
if NUMSPPTR22=. and LASTINT=2010 and samecode10=1 and samename10=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2010 and 2022*/
if NUMSPPTR22=. and LASTINT=2010 and samecode10=0 and samename10=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2008*/
/*********************************************************************/
samecode08=0;
samename08=0;
if LASTINT=2008 then do;
  if spptrtype=RELSPPTRDLI then samecode08=1;
  if spptrname=name08 then samename08=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2008 and 2022*/
if NUMSPPTR22=. and LASTINT=2008 and samecode08=1 and samename08=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2008 and 2022*/
if NUMSPPTR22=. and LASTINT=2008 and samecode08=0 and samename08=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2006*/
/*********************************************************************/
samecode06=0;
samename06=0;
if LASTINT=2006 then do;
  if spptrtype=RELSPPTRDLI then samecode06=1;
  if spptrname=name06 then samename06=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2006 and 2022*/
if NUMSPPTR22=. and LASTINT=2006 and samecode06=1 and samename06=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2006 and 2022*/
if NUMSPPTR22=. and LASTINT=2006 and samecode06=0 and samename06=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2004*/
/*********************************************************************/
samecode04=0;
samename04=0;
if LASTINT=2004 then do;
  if spptrtype=RELSPPTRDLI then samecode04=1;
  if spptrname=name04 then samename04=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2004 and 2022*/
if NUMSPPTR22=. and LASTINT=2004 and samecode04=1 and samename04=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2004 and 2022*/
if NUMSPPTR22=. and LASTINT=2004 and samecode04=0 and samename04=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2002*/
/*********************************************************************/
samecode02=0;
samename02=0;
if LASTINT=2002 then do;
  if spptrtype=RELSPPTRDLI then samecode02=1;
  if spptrname=name02 then samename02=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2002 and 2022*/
if NUMSPPTR22=. and LASTINT=2002 and samecode02=1 and samename02=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2002 and 2022*/
if NUMSPPTR22=. and LASTINT=2002 and samecode02=0 and samename02=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Flags for constructing remaining universes for those whose DLI=2000*/
/*********************************************************************/
samecode00=0;
samename00=0;
if LASTINT=2000 then do;
  if spptrtype=RELSPPTRDLI then samecode00=1;
  if spptrname=name00 then samename00=1;
end;
/*Set variables for people who have same code and same spouse/partner name in 2000 and 2022*/
if NUMSPPTR22=. and LASTINT=2000 and samecode00=1 and samename00=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=RELSPPTRDLI;
end;
/*Set variables for people who have different code and same spouse/partner name in 2000 and 2022*/
if NUMSPPTR22=. and LASTINT=2000 and samecode00=0 and samename00=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*********************************************************************/
/*Construction for remaining universes for those whose DLI<=1998     */
/*********************************************************************/
/*Construction for people who are with the same spouse/partner as DLI
 based on checking names/types*/
if NUMSPPTR22=. and LASTINT<2000 and samecode98=1 and samename98=1 then do;
  NUMSPPTR22=NUMSPPTRDLI;
  RELSPPTR22=spptrtype;
end;
/*Construction for people who are with a new spouse/partner since DLI
 based on checking names/types*/
if NUMSPPTR22=. and LASTINT<2000 and samecode98=0 and samename98=1 then do;
  NUMSPPTR22=NUMSPPTRDLI+1;
  RELSPPTR22=spptrtype;
end;

Construction of ages at birth and months between births (2022 and XRND)

PUBLIC RELEASE VARIABLE NAME     PROGRAM VARIABLE NAMES
  Q1-3_A~M_1979                     DOBMO79
  Q1-3_A~Y_1979                     NDOBYR79
  C1DOB22~M_2022                    C1MOB22
  C1DOB22~Y_2022                    C1YOB22
  C2DOB22~M_2022                    C2MOB22
  C2DOB22~Y_2022                    C2YOB22
  C3DOB22~M_2022                    C3MOB22
  C3DOB22~Y_2022                    C3YOB22
  NUMKID22_2022                     NUMKID22
/*------------------------------------------------*/
/**********************************************************************/
/*   create age at first, second and third births for female          
    respondents.                                                     */
/**********************************************************************/
age1b22=-3;  age2b22=-3;  age3b22=-3;
if MONTHRB>0 and NYEARRB>0 and C1YOB22>0 and C1MOB22>0  then do;
 if MONTHRB>C1MOB22  then age1b22=C1YOB22-NYEARRB-1;
 else age1b22=C1YOB22-NYEARRB;  
end;  
if MONTHRB>0 and NYEARRB>0 and C2YOB22>0 and C2MOB22>0  then do;
 if MONTHRB>C2MOB22  then age2b22=C2YOB22-NYEARRB-1;
 else age2b22=C2YOB22-NYEARRB;  
end;  
if MONTHRB>0 and NYEARRB>0 and C3YOB22>0 and C3MOB22>0  then do;
 if MONTHRB>C3MOB22  then age3b22=C3YOB22-NYEARRB-1;
 else age3b22=C3YOB22-NYEARRB;  
end;  
if NUMKID22=0  then do;
 age1b22=-998;  age2b22=-998;  age3b22=-998;
end;
if NUMKID22=1  then do;
 age2b22=-997;  age3b22=-997;
end;
if NUMKID22=2  then age3b22=-996;
if INTV22 = 0 then do;
 age1b22=-5;  age2b22=-5;  age3b22=-5;
end;
/*********************************************************************/
/*   create months between first and second births and months       
    between second and third births                                 */
/*********************************************************************/
mo1b2b22=-3;  mo2b3b22=-3;
if C1MOB22>0 and C1YOB22>0 and C2MOB22>0 and C2YOB22>0  then mo1b2b22=
 (C2YOB22-C1YOB22)*22 + (C2MOB22-C1MOB22);
if NUMKID22=0  then mo1b2b22=-998;
if NUMKID22=1  then mo1b2b22=-997;  
if C2MOB22>0 and C2YOB22>0 and C3MOB22>0 and C3YOB22>0  then mo2b3b22=
 (C3YOB22-C2YOB22)*22 + (C3MOB22-C2MOB22);
if NUMKID22=0  then mo2b3b22=-998;
if NUMKID22=1  then mo2b3b22=-997;  
if NUMKID22=2  then mo2b3b22=-996;
if INTV22 = 0 then
do;
 mo1b2b22=-5;  mo2b3b22=-5;
end;

Users should note several caveats with regard to the creation of specific variables:

  1. The fertility data of male respondents was typically less closely scrutinized than that of the female respondent. From 1993 to 2012, separate edit flags for males and females were added to the Fertility and Relationship History record. Beginning in 2014, the fertility data of the males were reconciled, and only one edit flag is provided for both male and female respondent. In 2022, no edit flag is included, as respondents were asked only about new children since the date of last interview.
  2. Users may notice discrepancies in dates of birth or sex variables across time. These discrepancies arise as part of the data reconciliation process. Occasionally, a child who is initially reported as a biological child has been later found to be a stillbirth or a non-biological child and removed from the fertility record. It is important for the user to understand that when a date of birth or other information is corrected, we do not change the data for earlier points in time. Thus, there may be inconsistencies in the dates of birth and ages of specific children, or the total number of children, between the current fertility record and earlier reports.
  3. Variables indicating the number of children or the age of the youngest child in the household refer to the respondent's biological, adopted, or step-children present in the household at the time of the interview. These variables are created by cycling through the household record for the given survey year. The variable titles and labels were historically adjusted for the 1998 data release to make this distinction more apparent.
  4. Variables relating to the female pregnancy histories such as number of pregnancies, number of miscarriages/stillbirths, month and year began first pregnancy, age began first pregnancy, and outcome of first pregnancy have valid values only for female respondents interviewed at the survey year in question and who were also interviewed at the time of the 1982 and 1983 surveys when full retrospective pregnancy histories were collected. All male respondents as well as female respondents not interviewed in both 1982 and 1983 are coded as a "-4" on these variables since a complete pregnancy profile is unavailable. Beginning with 1992, miscarriages and stillbirths are collapsed into a single code ("2") on the variable "Outcome of First Pregnancy."
    Confidential abortion reports were collected in 1984, 1986, 1988, 1990, 1992, 1994, 1996, 1998, 2000, 2002, 2004, 2006, 2008, 2010, and 2012. This information has been incorporated into the creation of the pregnancy-related variables. For that small subset of female respondents for whom full pregnancy histories are unavailable, some will have full abortion data if they were interviewed in 1984. Thus, there are smaller numbers of respondents with a code of "-4" on the variable for number of abortions than on the other pregnancy variables. Current pregnancies are included in the count of the number of pregnancies as of a given survey date, and twins/triplets represent a single pregnancy. Where questionnaire items for the beginning date of the first pregnancy are unavailable and the outcome was a live birth, 9 months are subtracted from the child's birth date to obtain the beginning date of the first pregnancy. Where the outcome of the first pregnancy was an abortion reported only in one of the confidential reports, 3 months are subtracted.
  5. Beginning with the release of the 1985 marriage variables, an effort has been made to reconcile marriage dates with the key variables for current marital status made available in the "Key Variables" area of interest. For approximately 100 cases there are inconsistencies in the marriage histories over time, with some respondents changing their marital status from ever-married to never-married or vice-versa based on the marital status change item provided on the information sheet. Also, where the change was made very early in the longitudinal record and the respondent continued to verify the changed status in subsequent surveys, the marriage variables for 1985 and subsequent years have been altered accordingly and will differ from the marriage variables provided earlier. Where a change is recorded from never-married to ever-married using the information sheet item only, marriage dates were not collected and thus the respondent is missing information (or coded "-3") on the date of marriage. For all survey years, a marriage is considered to have ended only if the respondent reports a change to widowhood or divorce. Beginning with the 2012 release, the constructed dates of marriage variables have been expanded to include all reported marriages by NLSY79 respondents.
  6. All age variables referenced to events are constructed with the original date of birth of the respondent provided at the 1979 survey (R00003., R00004. and R00005). These variables were used to define a respondent's eligibility to be included in the NLSY79 sample.
  7. The variables indicating months between first marriage and first birth have traditionally ranged from negative to positive numbers, with specialized codes to indicate non-interview, no first child, no first marriage, and missing date information. Beginning with the 1998 data release, these data indicating months between first marriage and first birth for each FERTILE record 1982-2022 have been converted to all positive numbers. These variables are paired with a flag variable that indicates whether the first marriage occurred before or after the first birth. Both variables have been assigned new reference numbers. The specialized codes for non-interviews have been dropped; however, the other specialized codes have been retained. The original versions of these variables do not appear in the public release.
  8. The newly added relationship history variables help users track the number of spouse/partners identified through our data collection process. However, not all cohabiting partners may have been reported as such, and cohabiting partners could also have entered and exited households between survey rounds and thus be unavailable for identification.

Codebook categories

The following variables have special coding specifications that users need to be aware of when using the 1994-2018 supplemental fertility data.

  • R50882. Edit Flag for Female Respondents 1994 Survey
  • R51735. Edit Flag for Female Respondents 1996 Survey
  • R64871. Edit Flag for Female Respondents 1998 Survey
  • R70149. Edit Flag for Female Respondents 2000 Survey
  • R77125. Edit Flag for Female Respondents 2002 Survey
  • R85050. Edit Flag for Female Respondents 2004 Survey
  • T09861. Edit Flag for Female Respondents 2006 Survey
  • T22185. Edit Flag for Female Respondents 2008 Survey
  • T31165. Edit Flag for Female Respondents 2010 Survey
  • T41210. Edit Flag for Female Respondents 2012 Survey
  • T50322. Edit Flag for ALL Respondents 2014 Survey
  • T57804. Edit Flag for ALL Respondents 2016 Survey
  • T82275. Edit Flag for ALL Respondents 2018 Survey
  • T87968. Edit Flag for ALL Respondents 2020 Survey

This edit flag is a general code that indicates the status of the MOTHER'S fertility record, and the indicated changes do not specify which child was affected.

  • 0 = Consistent with previous supplemental fertility file records
  • 1 = A child made younger
  • 2 = A child made older
  • 3 = Corrected previously missing information
  • 4 = Information inconsistent with previous supplemental fertility; previous supplemental fertility information used
  • 5 = Information inconsistent with previous supplemental fertility; mother’s current information accepted reluctantly
  • 6 = IDs assigned out of birth order
  • 7 = Discrepancy between CRF and FERTILE; current FERTILE will be consistent with previous supplemental fertility, but CRF preserved for next survey round
  • 8 = Child removed from FERTILE; incorrectly recorded non-biological child
  • 9 = Child removed from FERTILE; incorrectly recorded pregnancy loss
  • 10 = IDs assigned out of birth order AND made a child younger
  • 11 = IDs assigned out of birth order AND made a child older
  • 12 = Sex changed from previous supplemental fertility
  • 13 = Data from mother inconsistent; one child deleted, another added
  • 14 = IDs out of birth order AND discrepancy between FERTILE and CRF (CRF preserved for next survey round)
  • 15 = Child removed from FERTILE; incorrectly recorded pregnancy loss AND changed sex on another child from previous FERTILE
  • 16 = Made current supplemental fertility consistent with current Child Supplement (new child)
  • 17 = Sex missing from current CRF (new child); used information from current CS
  • 18 = Child assessed in current round but inexplicably missing from current CRF; added to current supplemental fertility with residence information from HHR if possible
  • 19 = Hand edited date of death
  • 20 = Day of birth ONLY discrepancy between previous supplemental fertility and current CRF; unedited CRF day used
  • 21 = Child assessed in current survey round but mother is a noninterview
  • 22 = Mother added surprise older child; IDs out of birth order
  • 23 = Incorrect code of 99 (deleted) generated for deceased/adopted out child; information corrected
  • 24 = Duplicate date of birth of existing child on CRF; edited to reflect previous supplemental fertility
  • 25 = Non-biological child not previously on FERTILE deleted from current CRF
  • 26 = Incorrect code of 99 (deleted) generated for live child; status corrected and residence taken from HHR if possible
  • 27 = Incorrect HH flag generated by CAPI for deceased/adopted out child; information corrected (New code in 1996)
  • 28 = Residence missing from CRF; information from fertility section and/or HHR used (New code in 1996)
  • 29 = Partial interview; used previous supplemental fertility file; residence coded from HH record if possible (New code in 1998)
  • 30 = Incorrect code of 8 (deceased) generated for live child; status corrected and residence taken from HHR if possible (new code in 1998)
  • 31 = Information corrected based on YA respondent correcting birth, age not affected
  • 32 = Information corrected based on YA respondent correcting birth, age made older
  • 33 = Information corrected based on YA respondent correcting birth, age made younger
  • 34 = Child removed from FERTILE, added through interviewer error but not caught previously
  • 35 = Residence coded based on information from HHR
  • 36 = Residence coded from YA interview
  • 37 = Year of birth corrected based on information from HHR
  • 38 = Duplicate child removed from CRF, not previously in FERTILE
  • 39 = Sex and day of birth changed from previous supplemental fertility
  • 40 = One or more children made older and one or more younger, and IDs out of birth order
  • 41 = One or more children made older and one or more children younger
  • 42 = Child made older and missing child added
  • 43 = Removed duplicate caused by interviewer error and made one child younger
  • 44 = Corrected interviewer error that led to child missing from CRF
  • 45 = Edited to resolve historical FERTILE/CRF inconsistencies
  • 46 = Information inconsistent with previous supplemental fertility; respondent’s current information accepted reluctantly and non-biological child not previously on FERTILE deleted from current CRF
  • 47 = Removed duplicate caused by interviewer error and made one child older
  • 48 = Removed both duplicate child and nonbiological child
  • 49 = Removed nonbiological child and made one child younger
  • 50 = Removed nonbiological child and IDs out of birth order

There are three edit flags for MALE respondents for 1993-2012. The coding scheme for these flags appears in the codebook.