If I understand correctly, you just want to get the year of the Last_dep_date variable? I would assume that you have the variable stored as a numeric variable with a date format. If that is the case, then this code will capture just the year: data deposit; input client $ Last_dep_date DDMMYY8. ; format last_dep-date ddmmyy8. ; datalines ; A 27/12/07 B 04/08/07 C 02/04/08 ; run ; data deposit; set deposit; year=year(last_dep_date); run ; If your last_dep_date variable happens to be character, then you can use scan(last_dep_date,3,'/'). This means to treat the date variable as though it is 3 "words" separated by a "/" and you want to keep the 3rd "word" (or the year).
... View more