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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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