Hi all,


I have an unbalanced data

HTML Code:
 tsset code date
       panel variable:  code (unbalanced)
        time variable:  date, 01/01/2010 to 31/12/2018, but with gaps
                delta:  1 day
I want to generate a new variable that contains only the year (without day and month). Like the following.


HTML Code:
code    date        year
1    01/01/2010    2010
1    04/01/2010    2010
1    05/01/2010    2010 
1    06/01/2010    2010
1    07/01/2010    2010
1    03/01/2011    2011
1    04/01/2011    2011 
1    05/01/2011    2011 
1    06/01/2011    2011

What is the command that can be used for this purpose?

Any help will be highly appreciated.