I have a string date-second variable from which I need to extract year, quarter, month, week, day etc.
Here is the description:
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------------
datescriptwri~n str19 %19s date of writing of script
variable name type format label variable label
-----------------------------------------------------------------------------------------
datescriptwri~n str19 %19s date of writing of script
Code:
. list datescriptwritten +---------------------+ | datescriptwritten | |---------------------| 1. | 2011-01-03 00:00:00 | 2. | 2011-01-02 00:00:00 | 3. | 2011-01-04 00:00:00 | 4. | 2011-01-04 00:00:00 | 5. | 2011-01-04 00:00:00 | |---------------------|
Code:
. gen yeardisp=year(datescriptwritten) type mismatch r(109);
Sincerely,
Sumedha.
0 Response to Extract year, quarter, month, week, day
Post a Comment