Dear All
I have monthly series of interest rates and want to convert it into a quarterly series. I have tried to do this using collapse but I think I failed because of a problem in identifying dates in Stata.
This is what I have done:
The date part of the code produces corrects year, quarter and month but when I run collapse the output is ony 4 quarters.
I think the problem might be in the way date has been producted.
Can anyone help to solve this problem?
My data is:
I have monthly series of interest rates and want to convert it into a quarterly series. I have tried to do this using collapse but I think I failed because of a problem in identifying dates in Stata.
This is what I have done:
Code:
gen date = daily(DATE,"MDY") format date %td gen year = year(date) gen qua= quarter(date) gen mon = month(date) collapse (mean) Interest, by (qua)
I think the problem might be in the way date has been producted.
Can anyone help to solve this problem?
My data is:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str9 DATE float Interest "4/1/1953" 2.36 "5/1/1953" 2.48 "6/1/1953" 2.45 "7/1/1953" 2.38 "8/1/1953" 2.28 "9/1/1953" 2.2 "10/1/1953" 1.79 "11/1/1953" 1.67 "12/1/1953" 1.66 "1/1/1954" 1.41 "2/1/1954" 1.14 "3/1/1954" 1.13 "4/1/1954" .96 "5/1/1954" .85 "6/1/1954" .82 "7/1/1954" .84 "8/1/1954" .88 "9/1/1954" 1.03 "10/1/1954" 1.17 "11/1/1954" 1.14 "12/1/1954" 1.21 "1/1/1955" 1.39 "2/1/1955" 1.57 "3/1/1955" 1.59 "4/1/1955" 1.75 "5/1/1955" 1.9 "6/1/1955" 1.91 "7/1/1955" 2.02 "8/1/1955" 2.37 "9/1/1955" 2.36 "10/1/1955" 2.39 "11/1/1955" 2.48 "12/1/1955" 2.73 "1/1/1956" 2.58 "2/1/1956" 2.49 "3/1/1956" 2.61 "4/1/1956" 2.92 "5/1/1956" 2.94 "6/1/1956" 2.74 "7/1/1956" 2.76 "8/1/1956" 3.1 "9/1/1956" 3.35 "10/1/1956" 3.28 "11/1/1956" 3.44 "12/1/1956" 3.68 "1/1/1957" 3.37 "2/1/1957" 3.38 "3/1/1957" 3.42 "4/1/1957" 3.49 "5/1/1957" 3.48 "6/1/1957" 3.65 "7/1/1957" 3.81 "8/1/1957" 4.01 "9/1/1957" 4.07 "10/1/1957" 4.01 "11/1/1957" 3.57 "12/1/1957" 3.18 "1/1/1958" 2.65 "2/1/1958" 1.99 "3/1/1958" 1.84 "4/1/1958" 1.45 "5/1/1958" 1.37 "6/1/1958" 1.23 "7/1/1958" 1.61 "8/1/1958" 2.5 "9/1/1958" 3.05 "10/1/1958" 3.19 "11/1/1958" 3.1 "12/1/1958" 3.29 "1/1/1959" 3.36 "2/1/1959" 3.54 "3/1/1959" 3.61 "4/1/1959" 3.72 "5/1/1959" 3.96 "6/1/1959" 4.07 "7/1/1959" 4.39 "8/1/1959" 4.42 "9/1/1959" 5 "10/1/1959" 4.8 "11/1/1959" 4.81 "12/1/1959" 5.14 "1/1/1960" 5.03 "2/1/1960" 4.66 "3/1/1960" 4.02 "4/1/1960" 4.04 "5/1/1960" 4.21 "6/1/1960" 3.36 "7/1/1960" 3.2 "8/1/1960" 2.95 "9/1/1960" 3.07 "10/1/1960" 3.04 "11/1/1960" 3.08 "12/1/1960" 2.86 "1/1/1961" 2.81 "2/1/1961" 2.93 "3/1/1961" 2.88 "4/1/1961" 2.88 "5/1/1961" 2.87 "6/1/1961" 3.06 "7/1/1961" 2.92 end
Comment