Hello Statalister,
I'm trying to convert dates in Stata and I am having an issue with the listed year after conversion. The original data looks like this:
after running the following command: format %td date1, this is what happens.
state_name state_abv state_num date1
Alabama AL 1 16jul2080
Alaska AK 2 .
Arizona AZ 3 .
Arkansas AR 4 17jul2080
California CA 5 19jun2080
Colorado CO 6 17jul2080
Connecticut CT 7 18apr2080
Delware DE 8 26apr2080
Florida FL 9 .
Clearly, the dates (month and day) are correct, but not the year portion (these all happened in 2020). This might be a two step process to change the year, but I wanted to see if there was something else that I'm missing. The original dates were recorded a YMD so maybe that's why?
I'm trying to convert dates in Stata and I am having an issue with the listed year after conversion. The original data looks like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str14 state_name str2 state_abv byte state_num long date1 "Alabama" "AL" 1 44027 "Alaska" "AK" 2 . "Arizona" "AZ" 3 . "Arkansas" "AR" 4 44028 "California" "CA" 5 44000 "Colorado" "CO" 6 44028 "Connecticut" "CT" 7 43938 "Delware" "DE" 8 43946 "Florida" "FL" 9 . end
state_name state_abv state_num date1
Alabama AL 1 16jul2080
Alaska AK 2 .
Arizona AZ 3 .
Arkansas AR 4 17jul2080
California CA 5 19jun2080
Colorado CO 6 17jul2080
Connecticut CT 7 18apr2080
Delware DE 8 26apr2080
Florida FL 9 .
Clearly, the dates (month and day) are correct, but not the year portion (these all happened in 2020). This might be a two step process to change the year, but I wanted to see if there was something else that I'm missing. The original dates were recorded a YMD so maybe that's why?
Comment