Hi everyone,

I have a long variable for source date in this dataset I am working with.

This long variable identifies dates in this way:

31oct1979
31oct1980
31oct1981

But when I tried to get it from dataex for this post, it came up in the following way:

* Example generated by -dataex-. To install: ssc install dataex
clear
input long srcdate
7243
7609
7974
end
format %td srcdate

Now I want to create a year variable which should only consist of the last 4 digits of the original format i.e. 1979, 1980. Can someone help me with the appropriate coding for this?