DAY not recognized in WHERE

Reply
Contributor
Posts: 33

DAY not recognized in WHERE

Hey all.  I'm trying to create a new dataset with a WHERE condition on a variable that is in DAY format.  Here's the code:

 

DATA RCOST_OUTAGE_DUP2;

SET RCOST_OUTAGE_DUP (WHERE = (DAY_MO = 1));

RUN;

 

I get 0 records when I should get 2.  Any ideas?

Super User
Posts: 11,113

Re: DAY not recognized in WHERE

If you have applied a DAY format then the original value is a DATE value and and the normal comparison would be use a date literal in the form of 'ddMONyyyy'd.

 

Try

 

DATA RCOST_OUTAGE_DUP2;

SET RCOST_OUTAGE_DUP (WHERE = (DAY(DAY_MO) = 1));

RUN;

 

To use the DAY function to return the day of the month from the date variable.

Ask a Question
Discussion stats
  • 1 reply
  • 180 views
  • 0 likes
  • 2 in conversation