I import the data using proc import: proc import datafile='/data/bvd/AcademicsSample.txt' out=bvd.ac dbms=dlm replace; delimiter = '09'x; run; One of the extracted variables is Closing_date (proc contents result below): # Variable Type Len Format Informat 4 Closing_date Num 8 BEST12. BEST32. From proc print, I see the date as 20081231 for 31 December 2008. Problem: I cannot extract the year from this date. I tried using: 1) year=year(Closing_date); result is dots (log NOTE: Invalid argument to function YEAR(20081231) at line 324 column 7.) 2) year=year(datepart(Closing_date)); result is 1960 for all observations (no log NOTE) 3) substr(Closing_date,1,4); result is blanks (log NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 324:14) 4) I have tried a bunch of other options that I found online but nothing worked, although I might not have executed these options well Please help!
... View more