Hi all,
I would like to merge data of a time series variable into my using dataset. However, the problem is that in my using data I have quarterly data where quarters are specified as follows:
date:
310320xx is quarter 1
310620xx is quarter 2
310920xx is quarter 3
311220xx is quarter 4
So beforehand i had data in the form of day month year and I converted this to quarters using the following code in stata:
This is al fine. However the problem now is that my data source, uses a different distrubution of quarters. Here quarter 1 is equal to 01-01-20XX, quarter 2 01-04-20xx etc. However, monthly data is also available of this time series variable.
Now I can apply two seperate methouds to links these two:
1) using the monthly data and link the date 01-04-20XX to the first quarter of my dataset, 01-07-20xx to the second quarter etc.
OR
2) using the averaging method where the average value of the months 01-01-20XX and 01-02-20XX and 01-03-20XX is the value for the first quarter (so 31-03-20XX).
My specific question is the following: how can I do this in Stata? So how can I convert this time serie variable in order to merge it to my using dataset?
This is how my time serie variable looks (both in quarterly and monthly values) which I want to merge with my using dataset:
Quarterly:
Monthly:
Thank you in advance for helping me out!
Yannick
I would like to merge data of a time series variable into my using dataset. However, the problem is that in my using data I have quarterly data where quarters are specified as follows:
date:
310320xx is quarter 1
310620xx is quarter 2
310920xx is quarter 3
311220xx is quarter 4
So beforehand i had data in the form of day month year and I converted this to quarters using the following code in stata:
Code:
​generate datum= qofd(date(Data, "DM20Y")) format %tq datum
Now I can apply two seperate methouds to links these two:
1) using the monthly data and link the date 01-04-20XX to the first quarter of my dataset, 01-07-20xx to the second quarter etc.
OR
2) using the averaging method where the average value of the months 01-01-20XX and 01-02-20XX and 01-03-20XX is the value for the first quarter (so 31-03-20XX).
My specific question is the following: how can I do this in Stata? So how can I convert this time serie variable in order to merge it to my using dataset?
This is how my time serie variable looks (both in quarterly and monthly values) which I want to merge with my using dataset:
Quarterly:
Code:
2001-01-01 4.81 2001-04-01 3.47 2001-07-01 2.77 2001-10-01 1.33 2002-01-01 1.25 2002-04-01 1.25 2002-07-01 1.25 2002-10-01 0.75
Code:
2001-01-01 5.52 2001-02-01 5.00 2001-03-01 4.81 2001-04-01 4.28 2001-05-01 3.73 2001-06-01 3.47 2001-07-01 3.25 2001-08-01 3.16 2001-09-01 2.77 2001-10-01 2.02 2001-11-01 1.58 2001-12-01 1.33 2002-01-01 1.25 2002-02-01 1.25 2002-03-01 1.25 2002-04-01 1.25 2002-05-01 1.25 2002-06-01 1.25 2002-07-01 1.25 2002-08-01 1.25 2002-09-01 1.25 2002-10-01 1.25 2002-11-01 0.83 2002-12-01 0.75
Thank you in advance for helping me out!
Yannick
Comment