<?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 Deidentification Dates and the ID in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/825920#M35241</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date&lt;/P&gt;&lt;P&gt;253645&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/23/2004&lt;/P&gt;&lt;P&gt;234654&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/2001&lt;/P&gt;&lt;P&gt;243657&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/1999&lt;/P&gt;&lt;P&gt;243657&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/06/2003&lt;/P&gt;&lt;P&gt;326789&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 09/03/2009&lt;/P&gt;&lt;P&gt;983211&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/03/2007&lt;/P&gt;&lt;P&gt;983211&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 08/10/2002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to deidentify the ID and the Date and saved it. I also want to run the code&amp;nbsp; to cancel the deidentified variables to original ID and Date&amp;nbsp; if needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you let me know if this is done is SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 13:44:37 GMT</pubDate>
    <dc:creator>Smitha9</dc:creator>
    <dc:date>2022-07-28T13:44:37Z</dc:date>
    <item>
      <title>Deidentification Dates and the ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/825920#M35241</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date&lt;/P&gt;&lt;P&gt;253645&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/23/2004&lt;/P&gt;&lt;P&gt;234654&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/2001&lt;/P&gt;&lt;P&gt;243657&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/1999&lt;/P&gt;&lt;P&gt;243657&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/06/2003&lt;/P&gt;&lt;P&gt;326789&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 09/03/2009&lt;/P&gt;&lt;P&gt;983211&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/03/2007&lt;/P&gt;&lt;P&gt;983211&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 08/10/2002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to deidentify the ID and the Date and saved it. I also want to run the code&amp;nbsp; to cancel the deidentified variables to original ID and Date&amp;nbsp; if needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you let me know if this is done is SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 13:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/825920#M35241</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2022-07-28T13:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Deidentification Dates and the ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/825937#M35242</link>
      <description>&lt;P&gt;Use hash objects:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* the dataset you have */
data have;
input ID :$6. Date :mmddyy10.;
format date yymmdd10.;
datalines;
253645              01/23/2004
234654              02/05/2001
243657              03/06/1999
243657              05/06/2003
326789              09/03/2009
983211              04/03/2007
983211              08/10/2002
;

/* initialize a dataset which keeps the anonymized IDs */
data anonymize;
length id id_anon $6;
stop;
run;

/* anonymize, and keep a record */
data want;
set have end=done;
if _n_ = 1
then do;
  length id_anon $6;
  declare hash a (dataset:"anonymize");
  a.definekey("id");
  a.definedata("id","id_anon");
  a.definedone();
  declare hash b (dataset:"anonymize");
  b.definekey("id_anon");
  b.definedone();
end;
if a.find() = 0
then id = id_anon;
else do;
  id_anon = put(rand("integer",100000,999999),6.);
  do while (b.check() = 0);
    id_anon = put(rand("integer",100000,999999),6.);
  end;
  rc = a.add();
  rc = b.add();
  id = id_anon;
end;
if done then rc = a.output(dataset:"anonymize");
drop id_anon rc;
run;

/* repeat with expanded data */
data have_new;
input ID :$6. Date :mmddyy10.;
format date yymmdd10.;
datalines;
253645              01/23/2004
234654              02/05/2001
243657              03/06/1999
243657              05/06/2003
326789              09/03/2009
983211              04/03/2007
983211              08/10/2002
123456              07/27/2022
;

data want_new;
set have_new end=done;
if _n_ = 1
then do;
  length id_anon $6;
  declare hash a (dataset:"anonymize");
  a.definekey("id");
  a.definedata("id","id_anon");
  a.definedone();
  declare hash b (dataset:"anonymize");
  b.definekey("id_anon");
  b.definedone();
end;
if a.find() = 0
then id = id_anon;
else do;
  id_anon = put(rand("integer",100000,999999),6.);
  do while (b.check() = 0);
    id_anon = put(rand("integer",100000,999999),6.);
  end;
  rc = a.add();
  rc = b.add();
  id = id_anon;
end;
if done then rc = a.output(dataset:"anonymize");
drop id_anon rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Look at the resulting datasets.&lt;/P&gt;
&lt;P&gt;From there it should be easy to expand the logic for date, depending on if id and date form a pair or if id and date need to be anonymized separately.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 14:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/825937#M35242</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-28T14:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Deidentification Dates and the ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/828807#M35461</link>
      <description>&lt;P&gt;A slightly easier (from programming perspective) is the use of hash functions, like MD5.&lt;/P&gt;
&lt;P&gt;The result is not revertable, so you need to store the original value with the "deidentified" value in a table for later lookup.&lt;/P&gt;
&lt;P&gt;Not sure about date though, usually they carry business meaning. Do you want to create another valid date?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 11:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deidentification-Dates-and-the-ID/m-p/828807#M35461</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-08-16T11:24:30Z</dc:date>
    </item>
  </channel>
</rss>

