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

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
PaigeMiller
Diamond | Level 26

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

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

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
ywon111
Quartz | Level 8
To automatically figure out date of last Friday.

Thanks
PaigeMiller
Diamond | Level 26

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

 
--
Paige Miller
ywon111
Quartz | Level 8
It is a date-time variable
PaigeMiller
Diamond | Level 26

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
ballardw
Super User

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".

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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