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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 893 views
  • 0 likes
  • 1 in conversation