Greetings,
I am using Stata 18. I have the following data, on the date on which bank branches have opened.
While the below image is generated by 'dataex', the column values are programmed to look like dates & times, for example -
26mar1992 00:00:00
I request help to -
(i) Carve out just the date of opening, as I do not need the time
(ii) Generate a 'branchopen' variable that takes the value 2013 for all branches opened during or before 2013, and thereafter 2014, 2015 etc. for branches that have opened during or before 2014, 2015 etc.
Thank you,
Sneha Thayyil
I am using Stata 18. I have the following data, on the date on which bank branches have opened.
While the below image is generated by 'dataex', the column values are programmed to look like dates & times, for example -
26mar1992 00:00:00
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double rbi_date_of_open 1.0171872e+12 6.899904e+11 1.6799616e+12 1.6940448e+12 1.6454016e+12 1.6952544e+12 1.4926464e+12 1.2293856e+12 1.680048e+12 7.140096e+11 7.572096e+11 6.148224e+11 7.221312e+11 1.5619392e+12 1.6802208e+12 1.4956704e+12 3.62016e+11 1.8461952e+12 -1.722816e+12 6.810912e+11 3.332448e+11 1.2343968e+12 6.244128e+11 4.375296e+11 1.8120672e+12 1.3175136e+12 1.2331872e+12 1.869696e+12 1.7116704e+12 1.0140768e+12 4.472064e+11 1.8539712e+12 8.672832e+11 3.901824e+11 1.869696e+12 1.673136e+12 1.672272e+12 1.4573088e+12 1.6592256e+12 7.855488e+11 1.385856e+12 7.048512e+11 7.139232e+11 1.3175136e+12 5.262624e+11 6.785856e+11 1.4700096e+12 7.197984e+11 1.167696e+12 1.3709952e+12 9.113472e+11 4.17744e+11 1.4979168e+12 1.6720992e+12 1.772064e+12 1.404432e+12 1.7117568e+12 1.74312e+12 1.6699392e+12 1.7198784e+12 4.166208e+11 4.996512e+11 -5.146848e+11 1.4926464e+12 6.51888e+11 4.562784e+11 5.17536e+11 1.6564608e+12 6.677856e+11 1.3175136e+12 1.8513792e+12 7.363872e+11 1.3281408e+12 3.147552e+11 5.363712e+11 4.63104e+10 -1.335744e+11 1.3175136e+12 3.619296e+11 1.512e+12 1.769904e+12 1.4217984e+12 1.6415136e+12 1.6903296e+12 1.291248e+12 1.6564608e+12 5.61168e+11 1.4948064e+12 1.7592768e+12 6.701184e+11 3.40416e+11 1.497744e+12 1.6172352e+12 4.87728e+11 5.038848e+11 1.4979168e+12 1.6401312e+12 6.57072e+11 1.4698368e+12 1.5402528e+12 end format %tc rbi_date_of_open
(i) Carve out just the date of opening, as I do not need the time
(ii) Generate a 'branchopen' variable that takes the value 2013 for all branches opened during or before 2013, and thereafter 2014, 2015 etc. for branches that have opened during or before 2014, 2015 etc.
Thank you,
Sneha Thayyil
Comment