02-27-2012 07:17 AM
i have a large dataset that includes a variable which is a record of last date of deposit for clients. So you may have
......with the earliest year being 2007 and the latest year being 2010. (Concentrating on the year only)
The task is to allocate a score based on the YEAR of Last_dep_date. So that a score of 4 is allocated to 2010 and a score of 1 is allocated to 2007 . What statements can i use and how do i compose the query.
02-27-2012 08:48 AM
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:
deposit;input client $ Last_dep_date DDMMYY8.
;format last_dep-date ddmmyy8.
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).