Numeric longest particular
As well as using a selector variable to search for a longest particular sequence by selecting from a drop-down list of all the selector codes for the variable, you can also carry out this type of investigation by defining a longest particular sequence as a numeric range.
Scenario¶
Find the longest sequence of holidays a person has taken to the USA where the cost of the booking is in the range of £500-1000¶
To get started:
- Open a new Expression window in your workspace.
- Click on the
Add Aggregation button and then on the tab entitled Frequency(Bookings) that opens up at the bottom of the window. - In the Type drop down select Pattern Match.
- Set the Grouping Table to People and Transactional Table to Bookings.
- Drag the Booking Date variable onto the Order records by drop-box and leave the From as Earliest to Latest.
- Select Pattern Match Numeric Variable
- Drag the Cost numeric variable onto the pattern numeric variable drop-box.
- From the Pattern Match Numeric Type drop-down select Longest Particular.
- In the Particular Range box, enter 1000-2000.
- From the Return the drop-down select Pattern Length.
-
Create a selection of bookings to the United States and drag and drop this onto the filter drop-box.
-
Name the expression - for example, Longest Particular-USACost500-1000.
-
Drag and drop the expression onto a data grid to view the results:
Note
This functionality is accessible in the user interface for the Pattern Match aggregation and Sequence Analysis wizard.
In the following data grid, further information has been added using different 'return' options:
- The sum of the cost for the values in the matched pattern.
-
The mean of the cost for the values in the matched pattern.
In the highlighted example, all four transactions to the United States satisfy the criteria of costing between £500-1000. The sum of the cost of those transactions is £3031.50, with an average booking cost of £757.88.
Related topics:


