<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create anonymised ID in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759445#M240007</link>
    <description>&lt;P&gt;Thank you! Very helpful.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 18:56:05 GMT</pubDate>
    <dc:creator>sasuser_sk</dc:creator>
    <dc:date>2021-08-04T18:56:05Z</dc:date>
    <item>
      <title>How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/704949#M216150</link>
      <description>&lt;P&gt;Is there a way to create anonymized ID in SAS?&amp;nbsp; &amp;nbsp;which can also account for the new ID's added later.&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;Original data:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;Anonimsed ID&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;204&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;206&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;208&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New data:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;Anonimsed ID&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;204&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;206&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;208&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;201&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;203&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So retain the anonymized IDs created for the original ID's and only anonymise the newly added ID's.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 05:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/704949#M216150</guid>
      <dc:creator>ari</dc:creator>
      <dc:date>2020-12-10T05:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/704976#M216156</link>
      <description>&lt;P&gt;There are some point to clarify:&lt;/P&gt;
&lt;P&gt;- Is ID numeric or char type?&lt;/P&gt;
&lt;P&gt;- For any N observations there may be an infinite number of new possible IDs&lt;/P&gt;
&lt;P&gt;&amp;nbsp; which means you must define:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (1) A range to look for IDs&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (2) Define the rules to create anonymized IDs - either sequential or random&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;and the amount of new IDs to add.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if there is any general tool to do it, but&lt;/P&gt;
&lt;P&gt;you can create a dataset with the full range and pick out of it the new IDs which do not&lt;/P&gt;
&lt;P&gt;exist in your original table.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 08:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/704976#M216156</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-10T08:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/705013#M216176</link>
      <description>&lt;P&gt;If you need to revert back to original id, you need a look-up table that contains the translation.&lt;/P&gt;
&lt;P&gt;Using such table you can use a surrogate key/seq no approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A more simple approach is to hash the key, potentially using a secret salt (a constant that you concatenate before hashing).&lt;/P&gt;
&lt;P&gt;Hashes are almost impossible to revert.&lt;/P&gt;
&lt;P&gt;There is a theoratical possibility to get duplicates, but the risk extremly low.&lt;/P&gt;
&lt;P&gt;How to go about this depends on you requirements of your anonymization.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 10:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/705013#M216176</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2020-12-10T10:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/705018#M216180</link>
      <description>&lt;P&gt;See here how to use hash objects to read and maintain lookup tables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data old;
input id $;
datalines;
1
2
3
;

data new;
input id $;
datalines;
1
2
3
4
5
;

/* set up the original lookup table */

data enc;
set old end=done;
length anon $3;
if _n_ = 1
then do;
  declare hash l (ordered:"a");
  l.definekey("id");
  l.definedata("id","anon");
  l.definedone();
  declare hash k ();
  k.definekey("anon");
  k.definedone();
end;
anon = put(rand("integer",200,999),z3.);
do while (k.check() = 0);
  anon = put(rand("integer",200,999),z3.);
end;
rc = l.add();
rc = k.add();
if done then l.output(dataset:"lookup");
drop rc;
run;

/* encode a new table, and update the lookup table */
data enc_new;
set new end=done;
length anon $3;
if _n_ = 1
then do;
  declare hash l (dataset:"lookup",ordered:"a");
  l.definekey("id");
  l.definedata("id","anon");
  l.definedone();
  declare hash k (dataset:"lookup (keep=anon)");
  k.definekey("anon");
  k.definedone();
end;
if l.find() ne 0
then do;
  anon = put(rand("integer",200,999),z3.);
  do while (k.check() = 0);
    anon = put(rand("integer",200,999),z3.);
  end;
  rc = l.add();
  rc = k.add();
end;
if done then l.output(dataset:"lookup");
drop rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2020 10:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/705018#M216180</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-10T10:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759433#M240001</link>
      <description>&lt;P&gt;Hello KurtBremser:&lt;/P&gt;
&lt;P&gt;I used your code to generate an anonymized ID for my customer ID. Every time I run your code it generates a different new anon ID for my customer ID. I am sending data to third party and want to anonymize my ID and when they send data back to me (with additional info) I would want to join it back to my ID. &lt;STRONG&gt;So I want to have a fixed anon ID for my ID (like fixed seed)&lt;/STRONG&gt;. Is your code doing the logic that I'm wanting to build? If not, Is there any other way I can successfully anonymize my ID and join it back after receiving data from third party. Thank you for your help. I am still learning to read and understand your code as being a beginner.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just changed set "My Data File" and changed anon to "Customer_ID".&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 18:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759433#M240001</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-08-04T18:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759437#M240003</link>
      <description>&lt;P&gt;Note that the first data step will always create a new lookup table, so it must be run only&amp;nbsp;&lt;STRONG&gt;once&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;After the lookup table is created, you must always use the second step for updating.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 18:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759437#M240003</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-04T18:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759441#M240004</link>
      <description>&lt;P&gt;And the second data step would be to assign anon id to additional ids over time?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 18:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759441#M240004</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-08-04T18:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759444#M240006</link>
      <description>Yes. It first loads the lookup table into the hash, so it can use existing anonymizations, and writes it back out after it has been updated during the step.</description>
      <pubDate>Wed, 04 Aug 2021 18:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759444#M240006</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-04T18:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create anonymised ID in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759445#M240007</link>
      <description>&lt;P&gt;Thank you! Very helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 18:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-anonymised-ID-in-SAS/m-p/759445#M240007</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-08-04T18:56:05Z</dc:date>
    </item>
  </channel>
</rss>

