Hi,
I currently have a simple project in ESP which consists of a Source window, followed by a Pattern Window. The input stream is from a csv which has the following columns: id, stock, stock_price and amount_purchased. Using the Pattern window, I would like to detect when a certain id has purchased a certain stock in two separate events, with the second purchase having been for a lower price.
-- Define start event that returns true for every event and sets values for variables in context function event_function(event, context) return true, {id=event.id, stock=event.stock, old_price=event.stock_price, amount_purchased_old=event.amount_purchased} end -- Define event that returns true if current trade price is less than previous trade price function price_dec(event,context) if (event.id == context.data.id and event.stock == context.data.stock and event.stock_price < context.data.old_price) then return true, {new_price=event.stock_price, id=event.id, stock=event.stock, old_price=context.data.old_price, amount_purchased_new=event.amount_purchased, amount_purchased_old=context.data.amount_purchased_old} end return false end
What I am noticing is that my Pattern window does NOT seem to pick up the pattern properly if the first input row (first row of the csv file) is the start of the pattern. Does anyone know why this may be the case?
I moved this topic to the "Streaming Analytics" - board.
That's a more appropriate channel for ESP questions.
Hopefully, question will get an answer now.
Koen
Hi,
Can you please provide the model with a sample data and expected output to check what may be happening here.
Thanks,
Joydeep
Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.