Dear All,
I know this subject has appeared on the forum quite often. However, I didn't find a solution to my problem.
I importer data from xlsm. I have monthly date in string like 12.2021. I wanna obtain a year from it.
I used a command destring date, gen(date_1).
However, it isn't what I want. E.g. for 12.2010 I obtained 12.201.
When I typed gen year=yofd(date_1)
I got 1960 for 2009
Please help me. I'm out of the ideas. I tried encode, real, recast but I didn't obtain what I wanted
I know this subject has appeared on the forum quite often. However, I didn't find a solution to my problem.
I importer data from xlsm. I have monthly date in string like 12.2021. I wanna obtain a year from it.
I used a command destring date, gen(date_1).
However, it isn't what I want. E.g. for 12.2010 I obtained 12.201.
When I typed gen year=yofd(date_1)
I got 1960 for 2009
Please help me. I'm out of the ideas. I tried encode, real, recast but I didn't obtain what I wanted
Comment