SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
β€’ Open full site

Create an Anonymized View Using K-Anonymity

Create anonymized views in SAP HANA Cloud, SAP HANA database using k-anonymity to avoid identification of individuals based on quasi-identifiers.

Overview

🎓 beginner 15 min. SAP HANA CloudBeginnerSAP HANA CloudSAP HANA Database

You will learn

  • βœ”How to define your anonymization strategy
  • βœ”How to define generalization hierarchies for quasi-identifiers
  • βœ”How to create an anonymized view using embedded hierarchies
  • βœ”How to create an anonymized view using hierarchy functions
  • βœ”How to verify the results of anonymization
Hui Li H Hui Li January 31, 2025
Created by August 16, 2021
Contributors

Prerequisites

Prerequisites

  • It’s recommended that you complete the previous tutorial.
  • You can download the sample CSV file to run the example scenario. Make sure to upload it into your database before running the queries given in the example.
  • If you would like to run the sample scenario, you need a running instance of SAP HANA Cloud, SAP HANA database in trial or production.

Steps

Intro

Disclaimer

In most cases, compliance with data privacy laws is not a product feature. SAP software supports data privacy by providing security features and specific functions relevant to data protection, such as functions for the simplified blocking and deletion of personal data. SAP does not provide legal advice in any form. The definitions and other terms used in this guide are not taken from any given legal source.

Now that you know the different approaches to data anonymization in SAP HANA Cloud, SAP HANA database you can start to implement them. In this tutorial, we will provide you with detailed step-by-step instructions how to use the method of K-Anonymity to avoid that individuals in your dataset can be re-identified based on quasi-identifiers.


Step 1 Define the anonymization strategy
β€”

Before you can start creating an anonymized view with K-Anonymity, you need to define the strategy of your anonymization. This includes two key aspects: The type of data in your dataset and the generalization hierarchies you want to apply.

Types of data

First, you need to define which columns contain what type of data:

  • Identifying data: What data needs to be removed from the anonymized view because it would lead to identification? For example, names or unique identification numbers.
  • Quasi-identifying data: What data could lead to people being re-identified, even if identifiers are removed because of individuals’ unique combination of attributes? For example, age, zip code, start year, education, marital status, location …
  • Sensitive data: What data should be analyzed but must not be associated with individuals? For example, salaries, health status, property…

Please note, that depending on your situation, data that is considered as quasi-identifiers in one use case could be considered sensitive data in a different use case and vice-versa, e.g. if peoples’ zip codes or age values should not be exposed.

Step 2 Define generalization hierarchies
+
Step 3 Create an anonymized view using embedded hierarchies
+
Step 4 View the results of anonymization
+
Step 5 Run an example scenario with sample data
+
Step 6 Get to know hierarchy functions
+
Step 7 Create a hierarchy function that shortens numbers from right to left
+
Step 8 Create a hierarchy function that groups values to ranges
+
Step 9 Explore other customization options for k-anonymity
+
Step 10 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 10
1. Define the anonymization strategy 2. Define generalization hierarchies 3. Create an anonymized view using embedded hierarchies 4. View the results of anonymization 5. Run an example scenario with sample data 6. Get to know hierarchy functions 7. Create a hierarchy function that shortens numbers from right to left 8. Create a hierarchy function that groups values to ranges 9. Explore other customization options for k-anonymity 10. Test yourself

Learn more →