BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
OS2Rules
Obsidian | Level 7

Hi All:

We are testing our code in SAS 9.3 and I have run across something odd.

We read a date and time field from an external pipe-delimited file using ANYDTDTM and the behaviour has changed since version 9.1. with:

            attrib  OpenDT    length=8.     format=datetime18.  informat=anydtdtm17.;

In 9.1 - using ANYDTDTM17.  and reading "02/04/09 08:48:11"  returns 04FEB09 08:48:11,

in 9.3 - you get 02APR09 08:48:11

so the 9.1 version reads the date part of the data as MM/DD/YY and the 9.3 version reads it as DD/MM/YY.

1) Is there an alternative date-time format that I can use to read my data (without significant program changes)?

2) Can I modify the behaviour of the ANYDTDTM in any wat to tell it how to read the data?

3) Am I just going to have to read the field in as TEST and parse it?

4) Should I just ignore it and hope it changes back in the next version?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
OS2Rules
Obsidian | Level 7


Here I go answering my own question -

SAS (in their infinite wisdom) added an option to control the format of the date when used this way as of version 9.2

OPTION DATESTYLE=MDY;

refer to: http://support.sas.com/kb/35/412.html

View solution in original post

1 REPLY 1
OS2Rules
Obsidian | Level 7


Here I go answering my own question -

SAS (in their infinite wisdom) added an option to control the format of the date when used this way as of version 9.2

OPTION DATESTYLE=MDY;

refer to: http://support.sas.com/kb/35/412.html

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
  • 1 reply
  • 762 views
  • 0 likes
  • 1 in conversation