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