Split observations

Hello all i have time series observations like 1970m1, 1970m2, 1970m3 .....1971m1 1972m2 and so on under the variable name Date as monthly time series data. I want to split these into two variable with observations 1970 and m1 , 1970 and m2 and so on.
How can this be done? I am new and will be thankful.
thank you.


Step 1 - convert the date from "month type" to "day type" using the dofm() function
Step 2 - use the year() and month() functions to extract the individual components of the date

You can combine the steps:
gen year=year(dofm(mydate))
gen month=month(dofm(mydate))

See -help datetime-