BookmarkSubscribeRSS Feed
ilikesas
Barite | Level 11

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

2 REPLIES 2
Kurt_Bremser
Super User

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 945 views
  • 0 likes
  • 3 in conversation