Any help would be appreciated.
I am looking to pull a weeks worth of data and get the rolling number of devices to accountsID's over a 24hr period and sort them with the highest count at the top. Hope that makes sense.
%let start = '01apr2021 00:00:00'dt;
%let end = '07apr2021 00:00:00'dt;
%let status = '14may2021 00:00:00'dt;
/* Base Data Query */
proc sql;
create table BaseQuery as
select ReportDate,
AccountID,
DeviceNumber,
datepart(CreateDate) format date9. as date,
timepart(CreateDate) format time8. as time,
TrackingNumber,
from my.database
where ReportDate between &start. and &end.
;
quit;
What do you mean by "rolling number of devices to accountsID's over a 24hr period"? Do you mean for every hour (or every minute, or every day) between &start and &end, you want the number of device records for the preceding 24 hours? If so, do you want this rolling number for each id, or accumulated over all id's?
Do you mean for every hour between &start and &end, you want the number of device records for the preceding 24 hours? yes
If so, do you want this rolling number for each id, or accumulated over all id's? Each ID
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 25. Read more here about why you should contribute and what is in it for you!
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.