Dear all,
Good morning.
From a dataset containing monthly dates I want to extract the relevant quarter. Most probably because I am doing something wrong I do not get the results I want. Please see a fragment of my data and the code I am using below.
Kind regards,
Nikos
Good morning.
From a dataset containing monthly dates I want to extract the relevant quarter. Most probably because I am doing something wrong I do not get the results I want. Please see a fragment of my data and the code I am using below.
Kind regards,
Nikos
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year month) 2009 1 2009 2 2009 3 2009 4 2009 5 2009 6 2009 7 2009 8 2009 9 2009 10 2009 11 2009 12 2010 1 2010 2 2010 3 2010 4 2010 5 2010 6 2010 7 2010 8 2010 9 2010 10 2010 11 2010 12 end
Code:
gen time = ym(year , month) format time %tm tsset time gen quarter = quarter(time) recode month (1/3=1)(4/6=2)(7/9=3)(10/12=4), gen(quarter2) ta quarter l time quarter*, sep(3)
Comment