Hi,
My data contains a string variable of date in MDY format ( 09/26/02, 12/19/13,.....). I want to convert it into quarterly format, such as 2002q3, 2013q4.
I have tried to use the following codes but the quarterly dates turn out to be wrong ( for example, it shows 1960q2 for 09/26/02).
encode stringdatevar, gen (newdatevar)
gen qtr=qofd(newdatevar)
format qtr %td
Would you mind letting me know what have I done wrong and how to fix this problem?
Thanks a lot!
My data contains a string variable of date in MDY format ( 09/26/02, 12/19/13,.....). I want to convert it into quarterly format, such as 2002q3, 2013q4.
I have tried to use the following codes but the quarterly dates turn out to be wrong ( for example, it shows 1960q2 for 09/26/02).
encode stringdatevar, gen (newdatevar)
gen qtr=qofd(newdatevar)
format qtr %td
Would you mind letting me know what have I done wrong and how to fix this problem?
Thanks a lot!
Comment