BookmarkSubscribeRSS Feed
SASSLICK001
Obsidian | Level 7

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

2015-08-17T09:32
2015-06-17T09:39
2015-03-17T09:42
2015-04-17T09:45
2015-02-17T09:48
2015-04-17T09:51
2015-01-17T11:57
2015-04-29T09:00

Can someone help me with this?

2 REPLIES 2
LinusH
Tourmaline | Level 20

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
Kurt_Bremser
Super User

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.

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 Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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