Dear all,
I am having an issue extracting the year from my date variable.
My date variable is already elapsed and formatted in a way that I can read the year followed by the month. Eg: 2013m1, 2013m2, ..... , 2015m12 - this variable is called modate
Now I need a variable that shows me only the year. I tried generating a variable year=modate and then formatting it so that it only displays the year;
gen year=modate
format year %ty
but then I get strange results such as 1961 or numbers like 636.
Can someone help me out?
Thanks!!
Cami
I am having an issue extracting the year from my date variable.
My date variable is already elapsed and formatted in a way that I can read the year followed by the month. Eg: 2013m1, 2013m2, ..... , 2015m12 - this variable is called modate
Now I need a variable that shows me only the year. I tried generating a variable year=modate and then formatting it so that it only displays the year;
gen year=modate
format year %ty
but then I get strange results such as 1961 or numbers like 636.
Can someone help me out?
Thanks!!
Cami
Comment