Help using Base SAS procedures

date

Reply
Contributor
Posts: 32

date

how to strip out year from this field.

It is in datetime format.

19JAN2006:17:14:33.072000

Thanks in advance..
Occasional Contributor
Posts: 15

Re: date

You can use the DATEPART function.
YEAR=DATEPART(yourdate);

I think that is the right syntax.
Super Contributor
Super Contributor
Posts: 365

Re: date

Hello SAS83,

This is a possible solution:
[pre]
data i;
dt="19JAN2006:17:14:33.072000"dt;
year=YEAR(DATEPART(dt));
format dt datetime.;
run;
[/pre]
Sincerely,
SPR
Contributor
Posts: 32

Re: date

Thank you !!
Ask a Question
Discussion stats
  • 3 replies
  • 104 views
  • 0 likes
  • 3 in conversation