07-13-2012 04:05 PM
I have a data set in excel which has some date information. I am trying to import it to sas. I have formated the date coloum in excel to date. As a result, in excel I can read the dates as mm/dd/yy. However when I import the data to SAS and read the dates, it is in different format. Also the date column is converted into character. For instance, the data in excel is as follows:
When I read the date in the SAS, it looks as follows:
The code I used to import the excel file into SAS is:
proc import out=work.a
datafile = "c:\users\destop\sas\b.xls"
dbms =xls replace;
I would appreciate if someone help me modify this code so that I can read the date correctly.
07-13-2012 06:09 PM
Try applying a format such as mmddyy10 to the SAS data.
Proc print data=work.a;
format data mmddyy10.;
The numeric values in the SAS data set are the number of days since 1 Jan 1960 and formats will display those numbers in a more human readable version.