Help using Base SAS procedures

How to mask unique identifier variable to make data anonymous yet keeping logical structure?

Accepted Solution Solved
Reply
Super Contributor
Posts: 373
Accepted Solution

How to mask unique identifier variable to make data anonymous yet keeping logical structure?

I have a repeated measurement data of individuals. How to mask the unique identifier variable (before data sharing) while keeping nature of repeated records and other logics embedded?  Uniq_id variable is very long in and length and numeric. Using SAS 9.4.

 

data temp; 
input uniq_id;
datalines;
2007122345567889
2007122345567889
2007122345567889
2008235689875421
2008235689875421
2008235689875421
;
data temp; set temp;
format uniq_id 20.;
run;

 


Accepted Solutions
Solution
‎01-04-2018 09:28 PM
Super User
Posts: 23,771

Re: How to mask unique identifier variable to make data anonymous yet keeping logical structure?

1. Create a list of your ID's, only unique values

2. Create a list of random IDs in the data set from step1, keeping the seed value stored - you'll want to keep track of the seeds over time so I recommend keeping a master file of seeds.

3. Match ID to RandomID so that an ID for a person is constant throughout the data set but it doesn't have the any significance.

 

Fully worked example here:

https://gist.github.com/statgeek/fd94b0b6e78815430c1340e8c19f8644

 

View solution in original post


All Replies
Solution
‎01-04-2018 09:28 PM
Super User
Posts: 23,771

Re: How to mask unique identifier variable to make data anonymous yet keeping logical structure?

1. Create a list of your ID's, only unique values

2. Create a list of random IDs in the data set from step1, keeping the seed value stored - you'll want to keep track of the seeds over time so I recommend keeping a master file of seeds.

3. Match ID to RandomID so that an ID for a person is constant throughout the data set but it doesn't have the any significance.

 

Fully worked example here:

https://gist.github.com/statgeek/fd94b0b6e78815430c1340e8c19f8644

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 483 views
  • 1 like
  • 2 in conversation