Dear all,
I have a string variable for my date with the format "mmmyyyy" (e.g. "Jan2020") and I want to turn it into a stata date with the format 2020m1 so as to match the rest of the date variables in the merging data.
I have tried:
rename date datestring
gen date = date(datestring, "MY")
format date %tm
but for some reason I get a float variable which for Jan2020 is 3786m4 instead of 2020m1. What am I doing wrong?
Thank you very much in advance,
Joan
I have a string variable for my date with the format "mmmyyyy" (e.g. "Jan2020") and I want to turn it into a stata date with the format 2020m1 so as to match the rest of the date variables in the merging data.
I have tried:
rename date datestring
gen date = date(datestring, "MY")
format date %tm
but for some reason I get a float variable which for Jan2020 is 3786m4 instead of 2020m1. What am I doing wrong?
Thank you very much in advance,
Joan
Comment