Derivation
<couple are assumed to be married according to residency data if date is the start of a co-resident episode, or if the reason for the end of episode is not birth/death nor divorce:>
gen rmardate=rdate if type==2 | (type==1 & w_rsn~=2 & w_rsn~=4 & h_rsn~=2 & h_rsn~=4)