Hi all,
I have data from 04jan1999 to 11apr2016
I would like to have 4 periods : First: 01/04/1999 à 10/12/2004
Second: 10/12/2004 à 29/12/2008
Third : 29/12/2008 à 08/12/2014
Fourth : 08/12/2014 à 11/04/2016
At the beginning, I simply create 4 different files by using the drop function :
etc.
But the problem is that it's not very practical to always loading different files.
I would like to regroup all the periods on one .dta file.
I would like to have date0 which is the data from 04jan1999 to 11apr2016, date1 which is the data for first period and so on until date4
So I tried to generate my periods by doing this :
But it doesn't works.
So I guess I am wrong, and I can't find on internet a topic which is explaining how to create "periods".
Maybe this can help :
Thank you for your time,
I have data from 04jan1999 to 11apr2016
I would like to have 4 periods : First: 01/04/1999 à 10/12/2004
Second: 10/12/2004 à 29/12/2008
Third : 29/12/2008 à 08/12/2014
Fourth : 08/12/2014 à 11/04/2016
At the beginning, I simply create 4 different files by using the drop function :
Code:
drop if date1 > date("20041210","YMD")
But the problem is that it's not very practical to always loading different files.
I would like to regroup all the periods on one .dta file.
I would like to have date0 which is the data from 04jan1999 to 11apr2016, date1 which is the data for first period and so on until date4
So I tried to generate my periods by doing this :
Code:
gen date1 = date<td(10dec2004) format date1 %td
So I guess I am wrong, and I can't find on internet a topic which is explaining how to create "periods".
Maybe this can help :
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 date double(crsoil crsru) byte _merge float date1 "04/01/1999" 10.94 25.2875 3 14248 "05/01/1999" 10.3 26.5876 3 14249 "06/01/1999" 10.67 27.4315 3 14250 "07/01/1999" 11.08 26.9876 3 14251 "08/01/1999" 11.7 27.2075 3 14252 "11/01/1999" 12.07 27.0148 3 14255 "12/01/1999" 11.78 26.6366 3 14256 "13/01/1999" 10.9 26.4489 3 14257 "14/01/1999" 11.1 26.5723 3 14258 "15/01/1999" 10.97 26.5662 3 14259 "18/01/1999" 10.81 27.2075 3 14262 "19/01/1999" 11.19 26.7599 3 14263 "20/01/1999" 10.85 26.8922 3 14264 "21/01/1999" 11.14 26.6122 3 14265 "22/01/1999" 11.23 27.0034 3 14266 "25/01/1999" 11.21 26.8714 3 14269 "26/01/1999" 10.84 26.6191 3 14270 "27/01/1999" 11.03 26.5778 3 14271 "28/01/1999" 11.14 26.1643 3 14272 "29/01/1999" 11.34 26.3482 3 14273 "01/02/1999" 10.81 26.2429 3 14276 "02/02/1999" 10.39 26.4356 3 14277 "03/02/1999" 10.78 26.5368 3 14278 "04/02/1999" 10.42 26.1337 3 14279 "05/02/1999" 10.18 26.2495 3 14280 end format %tdDD/NN/CCYY date1 label values _merge _merge label def _merge 3 "matched (3)", modify
Thank you for your time,
Comment