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


How can I make this DateTime variable (See below) to "01Jan2015:00:00:00.000"dt  and still have it as Date/Time variable.

Capture.PNG

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

or

datetimevariable = dhms(datepart(datetimevariable),0,0,0);

View solution in original post

6 REPLIES 6
sdang
Quartz | Level 8

Just wanted to add.  I still want to keep it as Date/Time variable but with the seconds., etc as  00:00:00.000.

SASKiwi
PROC Star

proc format;

   picture MyDT
  other =
'%d%B%Y:%0H:%0M:%0s' (DATATYPE=DATETIME);

run;

data _null_;

  now = datetime();

  format now MyDT26.3;

  put now = ;

run;

sdang
Quartz | Level 8

It is not doing it.  I still have the same result, showing the trailing minutes and seconds.. I want minutes and seconds as 00:00:00.000.  The result I wanted like that because I have two data sets with PlayDate and IGTCreatedDate (see image below).  I want to join them together.

Capture.PNG

Above is just a sample data.  I want to show the format between PlayerDayDate and IGTAccountCreated.  Because of the format I cannot join them together. The reason I want to join them is to see if a guest join on 01May2015 and play on 01May2015.

Please help me.

ballardw
Super User

or

datetimevariable = dhms(datepart(datetimevariable),0,0,0);

sdang
Quartz | Level 8

Thank you, that is what I need.  You solved my problem.

sdang
Quartz | Level 8

Thank you

SASKiwi                                      

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1115 views
  • 3 likes
  • 3 in conversation