DATA Step, Macro, Functions and more

How to read data values into SAS date values (informat)

Reply
Regular Contributor
Posts: 151

How to read data values into SAS date values (informat)

Hello SAS-users.

I have to read raw data (.csv) into SAS dataset.

Some fields are date values in the form submitted below:

Apr 17 2007 12:00AM,Apr 17 2011 12:00AM
May 28 2007 12:00AM,May 28 2010 12:00AM

I can not find an appropriate informat to read this data into SAS date values.

Thanks in advance for any help.
Super User
Posts: 9,676

Re: How to read data values into SAS date values (informat)

[pre]
options datestyle=mdy;
data temp;
infile datalines truncover dlm=' ';
input dt anydtdtm24.;
format dt dateampm24.;
datalines;
Apr 17 2007 12:00AM
Apr 17 2011 12:00AM
May 28 2007 12:00AM
May 28 2010 12:00AM
;
run;
[/pre]


Ksharp
Regular Contributor
Posts: 151

Re: How to read data values into SAS date values (informat)

Thank you very much.
It works.

Oleg
Ask a Question
Discussion stats
  • 2 replies
  • 126 views
  • 0 likes
  • 2 in conversation