<?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: Data Masking and encryption in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607939#M176834</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31762"&gt;@Sheeba&lt;/a&gt;&amp;nbsp; - You can use hashing techniques to transform character strings into shortened&amp;nbsp; and untranslatable version of the original:&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n05ptq6zr5amxkn18mjkyvbkjjos.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n05ptq6zr5amxkn18mjkyvbkjjos.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is useful in obfuscating sensitive data like bank account numbers and credit card numbers. The hashes still act as consistent data keys but can't be easily "de-hashed".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Encryption is more usually done at a higher level like across a table, a folder, or storage device.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I don't see the point of faking data, when techniques like hashing are so much easier.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Nov 2019 03:00:43 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2019-11-28T03:00:43Z</dc:date>
    <item>
      <title>Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607914#M176821</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to use sas to do the data masking from a similar dataset&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Name&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/P&gt;
&lt;P&gt;John Til&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12345&lt;BR /&gt;Mike Sam&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12346&lt;BR /&gt;Henry Ken &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;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12348&lt;/P&gt;
&lt;P&gt;Robert&amp;nbsp;pat&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12350&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to mask the variable name. I am able to use translate and substr functions and convert this to an encrypted value . the encrypted value is random string of characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible to use any function to encrypt it and &amp;nbsp;make it a meaningful name? is it possible to do it if we have a table /dataset with different values for names ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Name&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/P&gt;
&lt;P&gt;Jack&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12345&lt;BR /&gt;Brian&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12346&lt;BR /&gt;Jill&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12348&lt;/P&gt;
&lt;P&gt;Tom&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; 12350&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 00:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607914#M176821</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2019-11-28T00:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607923#M176826</link>
      <description>&lt;P&gt;I don't follow why you want to substitute real names for fictitious ones. What do you hope to achieve by doing this? Your names are already identified by your ID variable. If you don't want your data to contain real names then why not just drop the name variable?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 00:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607923#M176826</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-28T00:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607929#M176830</link>
      <description>&lt;P&gt;Hi SasKiwi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have some datasets which store confidential which is to be accessed only by certain roles. Right now we have different tables for different users. But we are trying to see if this is a possible option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 01:53:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607929#M176830</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2019-11-28T01:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607932#M176831</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31762"&gt;@Sheeba&lt;/a&gt;&amp;nbsp; - You should look at views on the same table. Create a view excluding customer names and set permissions so that users can only see the view.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 02:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607932#M176831</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-28T02:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607933#M176832</link>
      <description>&lt;P&gt;Hi SASKiwi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure..I will definitely look for that option....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also just for my knowledge sake, do you know any encryption algorithms/techniques within sas which can be used to encrypt variable names and replace it with a meaningful entity (like name with fake name, ID with a fake ID)&amp;nbsp; by reading from table or from an external db?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 02:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607933#M176832</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2019-11-28T02:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607939#M176834</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31762"&gt;@Sheeba&lt;/a&gt;&amp;nbsp; - You can use hashing techniques to transform character strings into shortened&amp;nbsp; and untranslatable version of the original:&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n05ptq6zr5amxkn18mjkyvbkjjos.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n05ptq6zr5amxkn18mjkyvbkjjos.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is useful in obfuscating sensitive data like bank account numbers and credit card numbers. The hashes still act as consistent data keys but can't be easily "de-hashed".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Encryption is more usually done at a higher level like across a table, a folder, or storage device.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I don't see the point of faking data, when techniques like hashing are so much easier.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 03:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607939#M176834</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-28T03:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607942#M176835</link>
      <description>&lt;P&gt;Hi SASKiwi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the details...I will study more about hashing and ways to de- hash it . &amp;nbsp;the fact that it can't be easily de-hashed makes it stronger compared to the encryption using translate functions, 1 byte to 2 byte swap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes, faking the data doesn't seem to be a good option compared to view creation and Hashing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for the details. I will study about this.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 03:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607942#M176835</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2019-11-28T03:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607983#M176861</link>
      <description>&lt;P&gt;If you need to consistently replace an item with another "readable" item, I would do the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;get (or create) a very large list of items that fit (e.g. names)&lt;/LI&gt;
&lt;LI&gt;shuffle that randomly, and add an empty variable for your original values&lt;/LI&gt;
&lt;LI&gt;use a hash object to store it in a data step&lt;/LI&gt;
&lt;LI&gt;do a lookup to see if you already have a match&lt;/LI&gt;
&lt;LI&gt;if not, retrieve the next empty one, and set your original value into the hash&lt;/LI&gt;
&lt;LI&gt;at the end of the step output the hash back into the lookup table, so you can reuse it for the next time&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Example code looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Name &amp;amp;$10. ID $;
datalines;
John Til    12345
Mike Sam    12346
Henry Ken   12348
Robert pat  12350
;

data lookup;
input newname $10.;
length name $10;
datalines;
Curt
David
Max
Sally
Jill
Tom
Brian
Jack
;

data want;
set have end=done;
if _n_ = 1
then do;
  length newname $10;
  /* create hash with already eisting translations */
  declare hash lookup1(dataset:"lookup (where=(name ne ''))");
  lookup1.definekey('name');
  lookup1.definedata('name','newname');
  lookup1.definedone();
  /* create hash with unused translations */
  declare hash lookup2(dataset:"lookup (where=(name = ''))",multidata:'yes');
  lookup2.definekey('name');
  lookup2.definedata('name','newname');
  lookup2.definedone();
  call missing(newname); * avoids "uninitialized" NOTE;
end;
if lookup1.find() = 0
then name = newname; * already existing translation;
else do;
  _name = name; * necessary, because the following statement will overwrite name with a missing value;
  rc = lookup2.find(key:''); * find next empty;
  rc = lookup2.removedup(); * remove from hash;
  name = _name;
  rc = lookup1.add(); * add to existing translations;
  name = newname; * set name for output;
end;
if done
then do;
  /* write both lookups out and concatenate */
  lookup1.output(dataset:'lookup1');
  lookup2.output(dataset:'lookup2');
  call execute('data lookup; set lookup1 lookup2; run;');
end;
drop rc _name newname;
run;

proc print data=want noobs;
run;

proc print data=lookup noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;(want)&lt;/P&gt;
&lt;PRE&gt;Name      ID

Curt     12345
David    12346
Max      12348
Sally    12350
&lt;/PRE&gt;
&lt;P&gt;(lookup)&lt;/P&gt;
&lt;PRE&gt;   Name       newname

Mike Sam       David 
Henry Ken      Max   
John Til       Curt  
Robert pat     Sally 
               Jill  
               Tom   
               Brian 
               Jack  
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 07:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/607983#M176861</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-28T07:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data Masking and encryption in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/608081#M176912</link>
      <description>&lt;P&gt;Hi KurtBremser,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for the details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will try this approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 16:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Masking-and-encryption-in-sas/m-p/608081#M176912</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2019-11-28T16:09:31Z</dc:date>
    </item>
  </channel>
</rss>

