Hi everyone,
I am having troubles extracting the year from my dateset. Some observations have the formal d/m/y, while others have only the year.
I tried the following
encode Acquirordateofincorporation, gen(Age)
generate AcquirorAge = yofd(Age)
gen AGE=(2021-AcquirorAge)
I also tried gen Year=real(substr(Acquirordateofincorporation)), but it doesnt work.
Any help would be highly valuable.
Thank You!
Iulia
0 Response to extract the year from an inconsistent string date variable
Post a Comment