BookmarkSubscribeRSS Feed
mkeintz
PROC Star

@DonH :  I agree.  The only reason I would recommend hash-of-hashes would be if the data were sorted by timestamp/customerid.  Otherwise it's wasteful.

 

However, even in that scenario the OP wouldn't need to keep all the records for all the customers in the hash objects - just the last 24 hours for each customer.  Of course, that memory savings would be at the expense of adding code to remove data items from a hash as they become stale.

 

The OP's task is logically equivalent to maintaining a portfolio of stocks with irregularly implemented BUYs and SELLs of one or another constituent of the portfolio, which is the context in which I wrote From Stocks to Flows: Using SAS® Hash Objects for FIFO, LIFO, and other FO’s.  In particular, the OP's task is like a FIFO treatment of inventory.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Array_Mover
Obsidian | Level 7

Thank you for responding.  I queried the transactions table and found, for the month of August, there are over 2 million distinct accounts with over 60 million transactions.

 

If that is too much, I would be more than happy doing a subset, a weeks worth, or only certain types of accounts. I work in financial services and we have a fraud mitigation tool that uses these moving averages (24 hours, 3 days, 7 days, 30 days) but the data is 'live' and constantly updates as customers transact, so it isn't available to us to use for ex post insights into how well rules are performing.

 

That being said, I would like to replicate this functionality in SAS so I can run simulations of rules over past data to see the rule performance based on different adjustments or scenarios.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 31 replies
  • 5522 views
  • 16 likes
  • 6 in conversation