Help using Base SAS procedures

converting datetime to date9.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

converting datetime to date9.

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


Accepted Solutions
Solution
‎07-22-2013 02:20 AM
Valued Guide
Posts: 2,167

Re: converting datetime to date9.

Alrernatively

DTDATE9.

presents dateime values in date9. style

View solution in original post


All Replies
Super Contributor
Posts: 296

Re: converting datetime to date9.

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;

Solution
‎07-22-2013 02:20 AM
Valued Guide
Posts: 2,167

Re: converting datetime to date9.

Alrernatively

DTDATE9.

presents dateime values in date9. style

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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