Hi All,
I would like to create a dummy variable that indicates if a child has parents in the dataset, given their ID numbers. Below is an example.
ID = the individuals ID
ID_F = the individual's father's ID
ID_M = the individual's mother's ID
Basically, for person 4003, I would like a new variable that indicates that at least one of their parents, (in this case, 4001 and 4002) exist as their own observations in the dataset, as shown by those values appearing in the ID column. For person 4170, this is not the case, and would be show by a value of "0" in this new variable.
Many thanks in advance!
Best,
Cora
I would like to create a dummy variable that indicates if a child has parents in the dataset, given their ID numbers. Below is an example.
ID = the individuals ID
ID_F = the individual's father's ID
ID_M = the individual's mother's ID
Basically, for person 4003, I would like a new variable that indicates that at least one of their parents, (in this case, 4001 and 4002) exist as their own observations in the dataset, as shown by those values appearing in the ID column. For person 4170, this is not the case, and would be show by a value of "0" in this new variable.
Many thanks in advance!
Best,
Cora
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float(ID ID_F ID_M) 1968 4001 4906 4907 1969 4001 4906 4907 1970 4001 4906 4907 1971 4001 4906 4907 1972 4001 4906 4907 1973 4001 4906 4907 1974 4001 4906 4907 1975 4001 4906 4907 1976 4001 4906 4907 1977 4001 4906 4907 1978 4001 4906 4907 1979 4001 4906 4907 1980 4001 4906 4907 1981 4001 4906 4907 1982 4001 4906 4907 1983 4001 4906 4907 1984 4001 4906 4907 1985 4001 4906 4907 1986 4001 4906 4907 1987 4001 4906 4907 1988 4001 4906 4907 1989 4001 4906 4907 1990 4001 4906 4907 1991 4001 4906 4907 1992 4001 4906 4907 1993 4001 4906 4907 1994 4001 4906 4907 1995 4001 4906 4907 1996 4001 4906 4907 1997 4001 4906 4907 1999 4001 4906 4907 1968 4002 4908 4909 1969 4002 4908 4909 1970 4002 4908 4909 1971 4002 4908 4909 1972 4002 4908 4909 1973 4002 4908 4909 1974 4002 4908 4909 1975 4002 4908 4909 1976 4002 4908 4909 1977 4002 4908 4909 1978 4002 4908 4909 1979 4002 4908 4909 1980 4002 4908 4909 1981 4002 4908 4909 1982 4002 4908 4909 1983 4002 4908 4909 1984 4002 4908 4909 1985 4002 4908 4909 1986 4002 4908 4909 1987 4002 4908 4909 1988 4002 4908 4909 1989 4002 4908 4909 1990 4002 4908 4909 1991 4002 4908 4909 1992 4002 4908 4909 1993 4002 4908 4909 1994 4002 4908 4909 1995 4002 4908 4909 1996 4002 4908 4909 1997 4002 4908 4909 1999 4002 4908 4909 1972 4003 4001 4002 1973 4003 4001 4002 1974 4003 4001 4002 1975 4003 4001 4002 1976 4003 4001 4002 1977 4003 4001 4002 1978 4003 4001 4002 1979 4003 4001 4002 1980 4003 4001 4002 1981 4003 4001 4002 1982 4003 4001 4002 1983 4003 4001 4002 1984 4003 4001 4002 1985 4003 4001 4002 1986 4003 4001 4002 1987 4003 4001 4002 1988 4003 4001 4002 1989 4003 4001 4002 1990 4003 4001 4002 1991 4003 4001 4002 1992 4003 4001 4002 1993 4003 4001 4002 1994 4003 4001 4002 1995 4003 4001 4002 1996 4003 4001 4002 1997 4003 4001 4002 1999 4003 4001 4002 2001 4003 4001 4002 2003 4003 4001 4002 2005 4003 4001 4002 2007 4003 4001 4002 2009 4003 4001 4002 2011 4003 4001 4002 1973 4170 4911 4912 1974 4170 4911 4912 1975 4170 4911 4912 1976 4170 4911 4912 1977 4170 4911 4912 end
Comment