A sample of my data looks as follows (my current data). I am trying to keep those observations whose marital status is married in at least one year. In other words, I wanna keep him/her in the data even if his/her marital status changes afterwards. Likewise, if a person's marital status is unmarried, I wanna drop him/her out. Thanks.
Nader
*My current data
Code:
clear all input id year str16 (marital) 1 2000 "married" 1 2002 "married" 1 2004 "married" 2 2000 "never married" 2 2002 "never married" 3 2000 "never married" 3 2002 "married" 3 2004 "divorced" 4 2002 "never married" 4 2004 "married" 5 2002 "divorced" 5 2004 "married" end list
Code:
clear all input id year str16 (marital) 1 2000 "married" 1 2002 "married" 1 2004 "married" 3 2002 "married" 3 2004 "divorced" 4 2004 "married" 5 2004 "married" end list
0 Response to drop/keep with multiple conditional statement
Post a Comment