🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Quartz | Level 8

## Greater than last Friday using WHERE

Is there a way to include dates greater than last Friday into this where statement.

where expiry = '31DEC9999:23:59:59'dt;

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Diamond | Level 26

## Re: Greater than last Friday using WHERE

So any time expiry is greater than 23:59:59 on the last Friday ... which is the same as any date-time greater than or equal to Saturday at 00:00:00, this should do it.

``where expiry >= intnx('dtweek.7',datetime(),0,'b');``

--
Paige Miller
6 REPLIES 6
Diamond | Level 26

## Re: Greater than last Friday using WHERE

Are you talking specifically about Friday, May 1, 2020? Or do you want code that automatically figures out what date last Friday was?

Is variable EXPIRY really a date-time variable as your code snippet implies?

--
Paige Miller
Quartz | Level 8

## Re: Greater than last Friday using WHERE

To automatically figure out date of last Friday.

Thanks
Diamond | Level 26

## Re: Greater than last Friday using WHERE

Is EXPIRY a date variable or a date-time variable?

--
Paige Miller
Quartz | Level 8

## Re: Greater than last Friday using WHERE

It is a date-time variable
Diamond | Level 26

## Re: Greater than last Friday using WHERE

So any time expiry is greater than 23:59:59 on the last Friday ... which is the same as any date-time greater than or equal to Saturday at 00:00:00, this should do it.

``where expiry >= intnx('dtweek.7',datetime(),0,'b');``

--
Paige Miller
Super User

## Re: Greater than last Friday using WHERE

If that obnoxious value is to indicate one that is not actually recorded then likely you should be using SAS Missing values.

Otherwise also sorts of "except when the value is this not actually the right value but we put it in anyway".

Discussion stats
• 6 replies
• 816 views
• 4 likes
• 3 in conversation