Issue in date column

Reply
Frequent Contributor
Posts: 101

Issue in date column

In my source file,I have date column (for eg.)

Name       DOJ

Raj           12/12/2012

Kumar       01/05/2013

Rohan       15/07/2013(today's date)

I want to apply filter - (today's date should not be in my target).

In extract transformation,I have applied (DOJ ^= 'today()'),(DOJ ^= 'date()'),(DOJ ^= "&sysdate()").

All are not working.

I need ny target as

Name       DOJ

Raj           12/12/2012

Kumar       01/05/2013

Kindly help me on this.

Occasional Contributor
Posts: 13

Re: Issue in date column

Posted in reply to Helannivas

Can you please elobrate data type of DOJ and where you want to applied filter

Frequent Contributor
Posts: 101

Re: Issue in date column

I have defined the date column as character in source and i need to load as numeric in target.

I need to apply date filter on target.(i.e after file reader).

I am using SAS DI 4.21.


Super Contributor
Posts: 297

Re: Issue in date column

Posted in reply to Helannivas

I think this is what you are after.

DATA HAVE;

INFILE DATALINES DELIMITER=",";

LENGTH NAME $5. DOJ $10.;

INPUT NAME $ DOJ $;

DATALINES;

RAJ,12/12/2012

KUMAR,01/05/2013

ROHAN,15/07/2013

;

RUN;

DATA WANT (WHERE = (DOJ ~= "&SYSDATE."D));

  SET HAVE;

  FORMAT DOJ1 DDMMYY10.;

  DOJ1 = INPUT(DOJ,?? DDMMYY10.);

  DROP DOJ;

  RENAME DOJ1 = DOJ;

RUN;

Frequent Contributor
Posts: 101

Re: Issue in date column

Posted in reply to Scott_Mitchell

Thanks Scott,

I have used input(DOJ,ddmmyy10.) ^="&SYSDATE."D

And ,its working.

Super Contributor
Posts: 644

Re: Issue in date column

Posted in reply to Helannivas

Be aware that &SYSDATE is not updated if your session spans more than one day.

I cannot see why input(DOJ,ddmmyy10.) ^= today()

would not work

Richard

Ask a Question
Discussion stats
  • 5 replies
  • 190 views
  • 0 likes
  • 4 in conversation