<?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: some form of masking in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893464#M352967</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp; The very similar forum discussion&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Mask-Data/td-p/884931" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;provides multiple options how you could approach this.&lt;/P&gt;</description>
    <pubDate>Sun, 10 Sep 2023 01:28:30 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-09-10T01:28:30Z</dc:date>
    <item>
      <title>some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874839#M345674</link>
      <description>&lt;PRE&gt;data cust;
input cust_id $8.;
datalines;
E4349567
C4127658
C6267260
E5211402 
K4729617
G6646262
;
run;

PROC PRINT DATA=CUST;
RUN;

data test2;
 set cust;
 string=COLLATE(1,256);
 high4=substr(string,55);
 cust_id=translate(cust_id, high4, string);
run;

proc print data=test2;
run;&lt;/PRE&gt;
&lt;P&gt;Can anyone let me know why I only have 1 entry in my output datset test2, I should have same number as my input datatset cust, right?&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 07:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874839#M345674</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-10T07:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874840#M345675</link>
      <description>&lt;P&gt;When I run your code, I have 6 observations in both.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 07:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874840#M345675</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-05-10T07:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874843#M345676</link>
      <description>&lt;P&gt;When something unexpected happens, always (as in&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;ALWAYS&lt;/STRONG&gt;&lt;/U&gt;)&amp;nbsp;post your complete log.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 07:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/874843#M345676</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-10T07:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893281#M352876</link>
      <description>&lt;PRE&gt;data test2;
 set cust;
 string=COLLATE(1,256);
 high4=substr(string,55);
 cust_id=translate(cust_id, high4, string);
run;&lt;/PRE&gt;
&lt;P&gt;does these create binary code? they look like symbols e.g.&lt;/P&gt;
&lt;P&gt;^@000^0^0&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 10:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893281#M352876</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-09-08T10:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893284#M352879</link>
      <description>&lt;P&gt;By shifting characters "up" by 55, you will eventually get results in the range of 128-182. Within this range, you have bytes which initiate a multi-byte UTF sequence, or are only allowed as UTF continuation bytes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need a reversible process which creates readable results and makes it at least&amp;nbsp;&lt;EM&gt;a little&lt;/EM&gt; hard to reverse for a third person, create a lookup table with values created by a random function. How you create such depends on the structure of the values to be encoded.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 11:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893284#M352879</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-08T11:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893438#M352948</link>
      <description>&lt;P&gt;&amp;nbsp;can I use encoding=utf8 to display it?&lt;/P&gt;
&lt;P&gt;I used encoding=utf8 to convert the file to csv and use codepage=1208 (which is also for utf8)&lt;/P&gt;
&lt;P&gt;to load into db2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however the content splited up into two rows with a cache return between&lt;/P&gt;
&lt;P&gt;so e.g. ^@000^@^@&lt;/P&gt;
&lt;P&gt;before ^@000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^@^@&lt;/P&gt;
&lt;P&gt;does it work if I use double quote to enclose it before converting into csv&lt;/P&gt;
&lt;P&gt;but I tired it keep giving me """"""""""""&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2023 13:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893438#M352948</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-09-09T13:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893445#M352952</link>
      <description>&lt;P&gt;If you want something readable which will reliably load into another software, you need a completely different approach. This crude "shift by 55" is clearly not the way to go.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2023 17:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893445#M352952</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-09T17:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893464#M352967</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp; The very similar forum discussion&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Mask-Data/td-p/884931" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;provides multiple options how you could approach this.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Sep 2023 01:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/893464#M352967</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-09-10T01:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902751#M356760</link>
      <description>&lt;PRE&gt;data test2;
 set cust;
 string=COLLATE(1,256);
 high4=substr(string,55);
 cust_id=translate(cust_id, high4, string);
run;&lt;/PRE&gt;
&lt;P&gt;what would be the code in sas to reverse the above?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 08:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902751#M356760</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-11-13T08:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902757#M356763</link>
      <description>&lt;P&gt;Just reverse the from &amp;amp; to in the translate function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
  set cust;
  string=COLLATE(1,256);
  high4=substr(string,55);
  cust_id_out_1=translate(cust_id, high4, string);
  cust_id_out_2=translate(cust_id_out_1,string,high4);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2023 08:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902757#M356763</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-11-13T08:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902766#M356771</link>
      <description>&lt;PRE&gt;data custinfo;
input cust_id $8.;
datalines;
E4349567
C4127658
C6267260
E5211402 
K4729617
G6646262
;
run;

data test1;
 set custinfo;
 string=COLLATE(1,256);
 high4=substr(string,55);
 cust_id_out_1=translate(cust_id, high4, string);
 cust_id_out_2=translate(cust_id_out_1,string,high4);
run;

proc print data=custinfo;
run;
proc print data=test1;
run;
&lt;/PRE&gt;
&lt;P&gt;I tried but cannot see cust_id_out_1 or cust_id_out_2, but no error though&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 10:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902766#M356771</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-11-13T10:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902777#M356775</link>
      <description>&lt;P&gt;Try starting a fresh SAS session and run it again.&amp;nbsp; The code works for me.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 12:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902777#M356775</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-11-13T12:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: some form of masking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902886#M356825</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;Works for me without any issues once I apply format $hex&amp;lt;n&amp;gt;. to print variables with values that can contain control characters and the like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data custinfo;
  input cust_id $8.;
  datalines;
E4349567
C4127658
C6267260
E5211402 
K4729617
G6646262
;
run;

data test1;
  set custinfo;
  string=COLLATE(1,256);
  high4=substr(string,55);
  cust_id_out_1=translate(cust_id, high4, string);
  cust_id_out_2=translate(cust_id_out_1,string,high4);
  format string $hex512. high4 $hex110. cust_id_out_1 $hex16.;
run;

proc print data=custinfo;
run;

proc print data=test1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Btw: If you really want to create and store a list of the first 256 characters in the collating sequence then you need to explicitly define the length for variable string as else it will default to a length of only $200 in your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also need to start counting at 0 and not 1.&lt;/P&gt;
&lt;P&gt;And... if you want to ensure consistent results for running in any SAS environment then you need also to care about the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_044/nlsref/p1d7k16vtur7s4n1nbbaf8ro6sk7.htm" target="_self"&gt;Collating Sequence&lt;/A&gt; and define it explicitly.&lt;/P&gt;
&lt;P&gt;I'd also consider to create a list of characters for variable string that only contains printable characters and that certainly don't contain control characters.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 23:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/some-form-of-masking/m-p/902886#M356825</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-11-13T23:38:59Z</dc:date>
    </item>
  </channel>
</rss>

