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

I used format = date9. to convert datetime to date9. but it doesn't work in an SQL statement. Any help?

1 ACCEPTED SOLUTION

Accepted Solutions
Peter_C
Rhodochrosite | Level 12

Alrernatively

DTDATE9.

presents dateime values in date9. style

View solution in original post

2 REPLIES 2
Scott_Mitchell
Quartz | Level 8

DATA HAVE;

  ATTRIB DATETIME1 FORMAT=DATETIME12.;

  DATETIME1 = DHMS(TODAY(),12,15,0);

RUN;

PROC SQL;

  CREATE TABLE WANT AS

  SELECT DATEPART(DATETIME1) AS DATE1 FORMAT = DATE9.

  FROM HAVE;

RUN;

Peter_C
Rhodochrosite | Level 12

Alrernatively

DTDATE9.

presents dateime values in date9. style

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 3766 views
  • 0 likes
  • 3 in conversation