Hi all,
I want to merge a dataset of Inflation imported to Stata using freduse (fantastic function!) with a dataset that contains stock prices.
The idea is to merge by date, as there is no other common variable.
The challenge is that date in the inflation dataset is reported on the first day of the month: 01jan2017, 01feb2017, whereas the date in the stock price dataset is reported on the first trading day of the month: 02jan2017.
I thought about removing the first to numbers from the date variable so that I get: jan2017, feb2017,...
However, using the function substr() does not work:
gen time = substr(date, 3,9)
Maybe there is another way to merge these datasets that are easier?
All help much appreciated!
Thomas
I want to merge a dataset of Inflation imported to Stata using freduse (fantastic function!) with a dataset that contains stock prices.
The idea is to merge by date, as there is no other common variable.
The challenge is that date in the inflation dataset is reported on the first day of the month: 01jan2017, 01feb2017, whereas the date in the stock price dataset is reported on the first trading day of the month: 02jan2017.
I thought about removing the first to numbers from the date variable so that I get: jan2017, feb2017,...
However, using the function substr() does not work:
gen time = substr(date, 3,9)
Maybe there is another way to merge these datasets that are easier?
All help much appreciated!
Thomas
Comment