SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

importing from excel to SAS (dates)

Reply
Super Contributor
Posts: 413

importing from excel to SAS (dates)

Hi,

I have an excel file with a date column that looks something like this:

date
text
12/02/2010
11/11/2011

The format is general and not in date

my importing procedure is the following:

PROC IMPORT OUT= board1

            DATAFILE= " K:\thesis comp bankruptcy\board1.xlsx"

            DBMS= EXCEL REPLACE;

    sheet = "Sheet1";

     GETNAMES=YES;

     MIXED=NO;

     SCANTEXT=YES;

     USEDATE=YES;

     SCANTIME=YES;

RUN;

What I would like to know is how to make such that when I import the file the dates are in mmddyy10. form.

Thank you

Super User
Posts: 6,972

Re: importing from excel to SAS (dates)

Looks like those columns are stored as text in Excel. Either make sure that dates are stored as Excel dates and have a suitable format, or save the spreadsheet as a .csv file and write a suitable data step for import.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,430

Re: importing from excel to SAS (dates)

Should really make a sticky on topic Excel plus import.  Totally agree, Excel is not a data transfer format.  Save to CSV and use a datastep, don't let proc export/import guess what you want to do etc.

Ask a Question
Discussion stats
  • 2 replies
  • 340 views
  • 0 likes
  • 3 in conversation