Hello,
I have a panel data with monthy data (from 1984m1 - 2016m5) that I want to convert to quarterly data. Moreover, I want to use only the last value of each quarter.
I use the following code to convert the data:
gen date1=monthly(date,"YM")
format date1 %tm
gen year_q=qofd(date1)
format year_q %tq
However, when I reach this last step...stata converts the data since the begining of 1960. For example, it says that my monthy value 1984m1 is equal to 1960q4.
My two questions are:
1 - How do I match the monthy data in the corresponding quartely period? Therefore: 1984m1=1984q1; 1984m2=1984q1; 1984m3=1984q1; 1984m4=1984q2; ...)
2 - What is the code that I have to use to select only the last value of each quarter (march, june, september, december)?
Thank you very much!
I have a panel data with monthy data (from 1984m1 - 2016m5) that I want to convert to quarterly data. Moreover, I want to use only the last value of each quarter.
I use the following code to convert the data:
gen date1=monthly(date,"YM")
format date1 %tm
gen year_q=qofd(date1)
format year_q %tq
However, when I reach this last step...stata converts the data since the begining of 1960. For example, it says that my monthy value 1984m1 is equal to 1960q4.
My two questions are:
1 - How do I match the monthy data in the corresponding quartely period? Therefore: 1984m1=1984q1; 1984m2=1984q1; 1984m3=1984q1; 1984m4=1984q2; ...)
2 - What is the code that I have to use to select only the last value of each quarter (march, june, september, december)?
Thank you very much!
Comment