Write and run SAS programs in your web browser

Reading date time in SAS

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Reading date time in SAS

I am trying to read date and time into one variable which is in below format DD-MM-YYYY  HH:MM

eg: 18-08-2017  20:55

informat Modified_DateTime datetime.;
input Modified_DateTime  1-17;

Accepted Solutions
Solution
a week ago
Super User
Posts: 10,874

Re: Reading date time in SAS

Did you try the anydtdtm. informat?

 

data junk;

x="18-08-2017 20:55";

y=input(x, anydtdtm.);

format y datetime.;

run;

View solution in original post


All Replies
Super User
Posts: 5,323

Re: Reading date time in SAS

So, how is it going?

Given your code snippet, your informat doesn't match your source data.

Find a more appropriate format in the SAS informat documentation.

Data never sleeps
New Contributor
Posts: 2

Re: Reading date time in SAS

I have tried finding possible informats but not successful
Solution
a week ago
Super User
Posts: 10,874

Re: Reading date time in SAS

Did you try the anydtdtm. informat?

 

data junk;

x="18-08-2017 20:55";

y=input(x, anydtdtm.);

format y datetime.;

run;

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 129 views
  • 0 likes
  • 3 in conversation