Hello Community,
I'm quite unexperienced with STATA and right now standing infront of my first major problem.
I want to plot a specific expenditure of OECD countries due to Covid-19. The data for this variable is uploaded every three mons (starting June2020, ending September2021).
I created a variable (date) with the format YYYYMM, therefore starting with 202006 and ending with 202109. my problem is that even with the commands xtset and tsset STATA does not understand the format of the date.
I tried to change the format into YYYYMMDD (adding a 01 to every observation) and when this didn't work, even to change this YYYYMMDD into a string variable (DateYMD) and destring it back with the command
generate date2 = date(dateYMD, "YMD")
The result is .... well, look at it yourselves
What can I do? And if it's possible, explain it to me please because I want to understand what went wrong here!
Thank you very much in advance and kind regards
Vincent
I'm quite unexperienced with STATA and right now standing infront of my first major problem.
I want to plot a specific expenditure of OECD countries due to Covid-19. The data for this variable is uploaded every three mons (starting June2020, ending September2021).
I created a variable (date) with the format YYYYMM, therefore starting with 202006 and ending with 202109. my problem is that even with the commands xtset and tsset STATA does not understand the format of the date.
I tried to change the format into YYYYMMDD (adding a 01 to every observation) and when this didn't work, even to change this YYYYMMDD into a string variable (DateYMD) and destring it back with the command
generate date2 = date(dateYMD, "YMD")
The result is .... well, look at it yourselves

date YM | dateYMD | dateYMD2 |
202006 | 20200601 | 22067 |
202010 | 20201001 | 22189 |
202012 | 20201201 | 22250 |
202103 | 20210301 | 22340 |
202106 | 20210601 | 22432 |
202109 | 20210901 | 22524 |
What can I do? And if it's possible, explain it to me please because I want to understand what went wrong here!
Thank you very much in advance and kind regards
Vincent
Comment