Reading dates

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Reading dates

Hi,  I need to read 8000+ dates which are of character variable. They are in DD-MMM-YY format. Could anybody please suggest me how to convert them to numeric (datetime19. format) variable?


Accepted Solutions
Solution
‎05-01-2015 04:14 PM
Grand Advisor
Posts: 10,192

Re: Reading dates

if you currently have that character variable then you can create a SAS date valued variable in a data step as

data want;

set have;

sasdate = input(charactervariable,anydtdtm.);

format sasdate datetime19.;

run;

The default time will be 00:00:00

View solution in original post


All Replies
Solution
‎05-01-2015 04:14 PM
Grand Advisor
Posts: 10,192

Re: Reading dates

if you currently have that character variable then you can create a SAS date valued variable in a data step as

data want;

set have;

sasdate = input(charactervariable,anydtdtm.);

format sasdate datetime19.;

run;

The default time will be 00:00:00

Respected Advisor
Posts: 4,606

Re: Reading dates

Try this:

data test;

input date :anydtdtm.;

format date datetime17.;

datalines;

01-MAY-2015

;

proc print; run;

PG

PG
New Contributor
Posts: 3

Re: Reading dates

Thank you.

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 192 views
  • 3 likes
  • 3 in conversation