The SAS Output Delivery System and reporting techniques

IMPORT CSV to SAS dataset

Posts: 51

IMPORT CSV to SAS dataset

Hello All

I have a csv file and in one of columns I have the sas datetime values! As shown below the first row is blank. Im using the import procedure and sas is taking only first 10 charancter and covnerting to yymmdd10. format in the sas dataset

How can force sas to take entire value? I am using sas 9.4 version


Can someone help me with this?

Super User
Posts: 5,852

Re: IMPORT CSV to SAS dataset

Posted in reply to SASSLICK001

PROC IMPORT has some limitations when it comes interpret date/datetime values.

And your datetime is in ISO format, which probably is not handled correctly w/ proc import.

SO either try to get a different format from the source, or import it using a data step.

15676 - Improved DATE,TIME, and DATETIME sampling in EFI, PROC IMPORT, andImport Wizard in SAS 9.2

Data never sleeps
Super User
Posts: 9,923

Re: IMPORT CSV to SAS dataset

Posted in reply to SASSLICK001

Keep in mind that PROC IMPORT is only a helper and has to make educated guesses. On itself, it does not import the file; instead, it creates a data step and runs that. This data step is also written to the log.

Take the data step from there, and use it in a separate code window to create a customised step that imports your data correctly.

The correct informat for your datetime values would be B8601DT16.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation