Dear Stata Experts,
I'm trying to generate a random ID for patients in my datasets so we can de-identify patients. I know that I could use this random function below to generate a five-digit random number. However, I'm trying to run this line of code across various datasets that may contain the same patient. Is there a way to retain the same random ID for the same patient across the dataset? Or is there a way to set a seed for each patient in the dataset using the patient's unique identifier (e.g. MRN, person number...etc.)? Any advice would be appreciated.
Thanks!
I'm trying to generate a random ID for patients in my datasets so we can de-identify patients. I know that I could use this random function below to generate a five-digit random number. However, I'm trying to run this line of code across various datasets that may contain the same patient. Is there a way to retain the same random ID for the same patient across the dataset? Or is there a way to set a seed for each patient in the dataset using the patient's unique identifier (e.g. MRN, person number...etc.)? Any advice would be appreciated.
Code:
gen random_int=runiformint(10000, 50000)
Thanks!
Comment