Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing a date from Excel to SAS gives me date+time?! 1

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
CA
Hi,
I am trying to import a datafile from Excel2000, and this one column that's formatted to be mm/dd/yy comes out as, say, 20/08/03 00:00:00
why on earth does it append time to it?
:(
 
Microsoft has three types of vars. char, numeric & datetime. You have to use the datepart() function to take the date out of the converted var. The same rules applies to MsAccess.
I hope this helps.
 
This may clarify it.

Import the file, the imported date variable would be what was in the excel file. It would be a datetime value.

In your SAS code,
data new; set imported_file_name;
dateonly=datepart(date_variable);
format dateonly mmddyy8.;


proc print;run; Or whatever you need to from here.
 
Thanks dje for clarifying my answer. I guess I should have left an example to explain my method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top