In a previous blog post, I demonstrated combining the power of SAS Event Stream Processing (ESP) and the SAS Quality Knowledge Base (QKB), a key component of our SAS Data Quality offerings. In this post, I will expand on the topic and show how you can work with data from multiple QKB locales in your event stream.
To illustrate how to do this I will review an example where I have event stream data that contains North American postal codes. I need to standardize the values appropriately depending on where they are from – United States, Canada, or Mexico – using the Postal Code Standardization definition from the appropriate QKB locale. Note: This example assumes that the QKB for Contact Information has been installed and the license file that the DFESP_QKB_LIC environment variable points to contains a valid license for these locales.
In an ESP Compute window, I first need to initialize the call to the Expression Engine Language function and load the three QKB locales needed – ENUSA (English – United States), ENCAN (English – Canada), and ESMEX (Spanish – Mexico).
Next, I need to call the appropriate Postal Code QKB Standardization definition based on the country the data is coming from. However, to do this, I first need to standardize the Country information in my streaming data; therefore, I call the Country (ISO 3-character) Standardization definition.
After that is done, I do a series of if/else statements to standardize the Postal Codes using the appropriate QKB locale definition based on the Country_Standardized value computed above. The resulting standardized Postal Code value is returned in the output field named PostalCode_STND.
I can review the output of the Compute window by testing the ESP Studio project and subscribing to the Compute window.
Here is the XML code for the SAS ESP project reviewed in this blog:
Now that the Postal Code values for the various locales have been standardized for the event stream, I can add analyses to my ESP Studio project based on those standardized values.
For more information, please refer to the product documentation:
- SAS Event Stream Processing
- DataFlux Expression Engine Language
- SAS Quality Knowledge Base
- SAS Data Quality