IMO you should not have to do this "complex" transformation from a text field to another text field if you use SAS Dates with formats: From text to text (your solution): data final; date_hoc="20140202"; /* text field */ run; proc sql; create table Report as select Put(mdy(input(substr(strip(put(DATE_HOC,$10.)),5,2),2.),input(substr(strip(put(DATE_HOC,$10.)),7),2.),input(substr(strip(put(DATE_HOC,$10.)),1,4),4.)),date9.) as Date_Hoc from final; quit; From numeric field to SAS Date (number) - my suggestion : data final; date_hoc=20140202; /* numeric field */ run; proc sql; create table Report as select input(DATE_HOC,yymmdd8.) as Date_Hoc format date9. /* SAS date */ from final; quit; The advantage of a SAS Date is that you can display it in many ways using different formats and also you can get more information from the date using functions as YEAR, MONTH, DAY, etc. CTorres
... View more