I have a dataset in which some observations take the values of the previous variable on the same row. For instance, variable sex takes observations for "date of birth - dob", dtdiagnosed take on the values of sex ..etc
Attached is a sample of the data using dataex
I would like to use a command that replaces sex to read either M or F as recorded in the the variable 'dtdiagnosed'
Thank you, in advance
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str10 sex str27 dtdiagnosed str11 dtenroled
" 7/28/1977" "M" " 3/16/2015"
" 6/15/1990" "F" " 8/12/2016"
" 6/15/1973" "F" "12/14/2016"
" 6/15/1984" "M" "10/24/2017"
" 6/15/1985" "F" "  5/4/2015"
" 3/26/2016" "F" " 5/18/2016"
end
------------------ copy up to and including the previous line ------------------

Regards
Mutugi