In SAS Viya, you can use the SAS Quality Knowledge Base (QKB) to perform data quality operations (e.g., parse and standardize) on your data either in SAS Data Studio (CAS) or in SAS Studio (CAS and/or SAS Compute). As an Administrator, you can add a customized QKB to your SAS Viya installation.
Note: To learn how to customize a QKB, you can take the Understanding the SAS Quality Knowledge Base VLE course. The QKB Customization Tool can be downloaded from here.
The high-level steps to add a customized QKB in SAS Viya for CAS and SAS Compute are:
A QKB must be in the QARC (QKB Archive) format to be imported to a CAS Server and/or SAS Compute in SAS Viya. A command-line QARC tool is provided to convert your QKB to this format. The tool to create the QARC file is available for download here.
I downloaded the Windows version of QARC program since the tool used to Customize a QKB is Windows-based, so it is easier to run this process there.
Select any image to see a larger version.
Mobile users: If you do not see this image, scroll to the bottom of the page and select the "Full" version of this post.
The tool needs to be extracted. I extract the program to my C:\Customized QKBs directory.
To create a QARC file, first locate the directory of your customized QKB. In my case it is located at: C:\Customized QKBs\CI33_customized.
Once you have located the directory that contains your customized QKB, then from a Windows command prompt run the following code:
Cd \path\to\qarc.exe
qarc create \path\to\qkb myqkb.qarc
In my case I submit the following commands.
cd "C:\Customized QKBs"
qarc create "C:\Customized QKBs\CI33_customized" CI33_customized.qarc
Note: It may take about 10 – 20 minutes to create the QARC file depending on the size of your customized QKB.
The QARC file has been created and is ready to be imported to CAS.
Note: In order to import the QKB file using the user interface, the QARC file must be in a location accessible from your local machine.
Next, log on to SAS Environment Manager as an Administrator to the Viya installation where you want to add the customized QKB. You must have SAS Administrator privileges to import a QKB QARC file into SAS Viya. When signing in, select Yes to assume the group SASAdministrators, so you have the appropriate privileges.
Select Manage Environment to access SAS Environment Manager, then select the Quality Knowledge Bases tab.
To import a QARC file, select and navigate to where the QARC file for the customized QKB is located by using the Browse button. Enter the target name and server for the QKB. Select Import to import the file.
Note: It may take about 5 – 10 minutes to import the QARC file.
Once the import is complete, confirm that the imported QKB is now listed.
After importing the QKB, to designate the newly imported QKB as the default QKB for your CAS server, add (or change) the configuration settings for the CAS server.
In SAS Environment Manager on the Configuration page, select the name of your CAS server. By default, this is cas-shared-default. Edit the sas.cas.instance.config: config section.
In the Contents area enter the following:
cas.DQSETUPLOC="DefaultQKBName"
cas.DQLOCALE="DefaultLocale"
Note: The DefaultQKBName must match the name found on the Quality Knowledge Bases page of SAS Environment Manager. The DefaultLocale is the 5-character QKB locale abbreviation. For example, ENUSA = English-United States and ESESP = Spanish-Spain. SAS Quality Knowledge Base for Contact Information 33 - QKB Locale ISO Codes
Below are my modified config settings to set my imported Customized QKB as the new default QKB.
After editing this configuration setting, you need to restart the sas-data-quality pod for the change to take effect by issuing the following commands:
kubectl -n name-of-namespace delete pods -l app.kubernetes.io/managed-by=sas-cas-operator
kubectl -n name-of-namespace get pods | grep sas-data-quality
kubectl -n name-of-namespace delete pod sas-data-quality-pod-name
Note: In the last command, replace sas-data-quality-pod-name with the name of the pod that is returned by the second command. This enables the automatic import of the QKB that is specified by the DQSETUPLOC server option.
Here is what I submitted to restart the sas-data-quality pod for my SAS Viya installation. Note: My namespace is gelenv.
Finally, after waiting a few minutes for the sas-data-quality pod to restart, return to the Quality Knowledge Bases tab in SAS Environment Manager and refresh the display to confirm that the Customized QKB is now set as the default QKB.
Note: It will take a few minutes for the pod to restart and reflect this change. It will display a message “No QKBs were found” until the pod is fully restarted.
To add the customized QKB to SAS Compute, upload its .qarc file to a location on your SAS Server. I uploaded mine here: /shared/gelcontent/Customized_QKBs/.
Next, you need to find the location of the QKB bash scripts for your SAS Viya installation by issuing the following command.
find . -name containerize-qkb.sh
In my case the QKB bash scripts are located here: ./project/deploy/gelenv/sas-bases/examples/data-quality/scripts/
Next, change directory to that location:
Then, run the following command to containerize your customized QKB:
bash containerize-qkb.sh "My Customized QKB" /path/to/myqkb.qarc registry.mycompany.com/mycustomizedqkb:v1
Note: registry name must be in lowercase with no spaces.
Note: It may take a few minutes for this script to complete.
Next, run the following command to deploy the customized QKB.
bash deploy-qkb.sh registry.mycompany.com/mycustomizedqkb:v1 | kubectl apply -n my-namespace -f –
Then run this command to create the sas-quality-knowledge-base-list-job.
bash list-qkbs.sh | kubectl apply -n my-namespace -f –
Then run the following command to get a list of registered QKBs for SAS Compute:
kubectl -n my-namespace logs job.batch/sas-quality-knowledge-base-list-job-nameReturnedFromPreviousCommand
All registered QKBs in SAS Compute are displayed including the customized one you just registered. Finally, run the following command to delete the sas-quality-knowledge-base-list-job you just created.
kubectl -n my-namespace delete job.batch/sas-quality-knowledge-base-list-job-nameReturnedFromPreviousCommand
In SAS Environment Manager on the Configuration page, select Compute service. Edit the sas.compute.server: configuration_options section.
In the Contents area enter the following:
-DQSETUPLOC "DefaultQKBName"
-DQLOCALE (DefaultLocale)
Note: The DefaultQKBName must match the name of the customized QKB returned from the listing of registered QKBs for SAS Compute. The DefaultLocale is the 5-character QKB locale abbreviation. For example, ENUSA = English-United States and ESESP = Spanish-Spain. SAS Quality Knowledge Base for Contact Information 33 - QKB Locale ISO Codes
Log out of all SAS Compute sessions. Must re-open compute session for change to take effect. I sign-out and close my browser with Viya. I re-open and sign back into my Viya installation.
In SAS Studio, test with a definition in the default locale specified for your default customized QKB to confirm customized QKB is being used.
A custom parse definition in my customized QKB is Clothing.
data _null_;
version=DQVERQKB();
token_names=DQPARSEINFOGET('Clothing');
put version;
put token_names;
run;
I have now confirmed that SAS Compute is using my customized QKB and default locale setting. Refer to the SAS Data Quality Language Reference section in the SAS Data Quality guide other code examples you can test with.
You can use your customized SAS Quality Knowledge Base (QKB) in both CAS and SAS Compute in SAS Viya to perform data quality operations. Refer to the QKB Management section in the SAS Data Quality guide for more information.
Find more articles from SAS Global Enablement and Learning here.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.