Hello all,
I have a variable titled "Trav_Date" in the following format "M/D/YYYY H:MM:SS AM." The variable is a string.
I want to convert the values to Stata date format and put them into a new variable called "Trav_Date_2."
The Stata manual has examples of conversions similar to what I want to do, but they don't work.
For example, I used this:
generate double Trav_Date_2 = date(Trav_Date, "MDYhms") .
It runs, but I get "no observations" when I tab the new variable.
Any help is appreciated!
(P.S.: I searched the forum, but had no luck in finding an answer.)
I have a variable titled "Trav_Date" in the following format "M/D/YYYY H:MM:SS AM." The variable is a string.
I want to convert the values to Stata date format and put them into a new variable called "Trav_Date_2."
The Stata manual has examples of conversions similar to what I want to do, but they don't work.
For example, I used this:
generate double Trav_Date_2 = date(Trav_Date, "MDYhms") .
It runs, but I get "no observations" when I tab the new variable.
Any help is appreciated!
(P.S.: I searched the forum, but had no luck in finding an answer.)
Comment