Dear statalist-members,
I am working with an asylum data-set from EUROSTAT (http://appsso.eurostat.ec.europa.eu/...ppctzm&lang=en).
The data is only available with monthly values. However, I need to aggregate it to quarterly values.
The time-ID was in the following form: 2008M01 (string variable).
Therefore, I used the following command to destring the time-ID:
gen int year = real(substr(time,1,4))
gen int month = real(substr(time,6,2))
gen int monthly = ym(year,month)
format monthly %tmMCY
Until this point everything worked out perfectly fine.
Then, my idea was to use the date and time functions and "qofd" in particular to create year-quarters and to collapse the data afterwards:
gen yq = qofd(monthly)
format yq %tq
collapse (sum) fasyl_appl, by(country yq)
Unfortunately, when I tried to generate "yq" the year quarters were not correct and I have no clue why this is the case.
************************************************** ************************************************** *************************************
************************************************** ************************************************** **************************************
Your help and advice is greatly appreciated!
Jule Beck,
University of Konstanz
I am working with an asylum data-set from EUROSTAT (http://appsso.eurostat.ec.europa.eu/...ppctzm&lang=en).
The data is only available with monthly values. However, I need to aggregate it to quarterly values.
The time-ID was in the following form: 2008M01 (string variable).
Therefore, I used the following command to destring the time-ID:
gen int year = real(substr(time,1,4))
gen int month = real(substr(time,6,2))
gen int monthly = ym(year,month)
format monthly %tmMCY
Until this point everything worked out perfectly fine.
Then, my idea was to use the date and time functions and "qofd" in particular to create year-quarters and to collapse the data afterwards:
gen yq = qofd(monthly)
format yq %tq
collapse (sum) fasyl_appl, by(country yq)
Unfortunately, when I tried to generate "yq" the year quarters were not correct and I have no clue why this is the case.
************************************************** ************************************************** *************************************
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str7 time str48 country long fasyl_appl int(year month monthly) float yq "2008M01" "Belgium" 1060 2008 1 576 6 "2008M01" "Bulgaria" . 2008 1 576 6 "2008M01" "Czech Republic" 155 2008 1 576 6 "2008M01" "Denmark" 235 2008 1 576 6 "2008M01" "Germany" 2395 2008 1 576 6 end format %tmMCY monthly
Your help and advice is greatly appreciated!
Jule Beck,
University of Konstanz
Comment