SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Select last 30 days by group

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Select last 30 days by group

[ Edited ]

Hello.

 

I am trying to select the past 30 days of data from the current date/time for multiple groups in SAS DI. This is a streaming data set that has new observations every 10 minutes. Schedule manager updates this SAS table every hour. 

 

My time is of the format: 08June2018:14:40:00.000 and named UTCDateTime

 

My group is based on a multiple categorical values in the "name" column

 

I have added a "group_by" on "name" and setup a "having" statement using the TODAY function thinking that it would report the past 30 days, but it only reports all of the timestamps for the past 30th day (which make sense now!). 

 

DATEPART(UTCDateTime) = TODAY()-30

 

Thanks in advance for your assistance. 

 

 


Accepted Solutions
Solution
2 weeks ago
Super User
Posts: 6,644

Re: Select last 30 days by group

Can we assume that UTCDateTime never contains values that go into the future?

 

You should be able to change = TODAY()-30 to >= TODAY()-30

View solution in original post


All Replies
Solution
2 weeks ago
Super User
Posts: 6,644

Re: Select last 30 days by group

Can we assume that UTCDateTime never contains values that go into the future?

 

You should be able to change = TODAY()-30 to >= TODAY()-30

Occasional Contributor
Posts: 12

Re: Select last 30 days by group

Posted in reply to Astounding
Yes. That worked. Thanks.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 179 views
  • 0 likes
  • 2 in conversation