Help using Base SAS procedures

Help with date

Reply
Frequent Contributor
Posts: 127

Help with date

I have date which is numeric format. I want the year from that.  I am getting blank value.

my date1 variable is yymmn6.  format.  For example if I have date1 = 201405,  I should get 2014, but I get blank value for year.

Can anybody help me, please?

Trusted Advisor
Posts: 1,228

Re: Help with date

You can try this.

data have;

dt="201405";

yr=year(input(dt,yymmn6.));

run;

proc print data=have;

run;

Occasional Contributor
Posts: 10

Re: Help with date

input(put(Date,6.),4.)

This is what I do. 

Respected Advisor
Posts: 4,927

Re: Help with date

Posted in reply to jenrscott827

Or year = floor(Date/100);

This is what I would do.

PG
Ask a Question
Discussion stats
  • 3 replies
  • 224 views
  • 0 likes
  • 4 in conversation