<?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: SHA256HEX function changes a different variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964987#M375755</link>
    <description>&lt;P&gt;Just the LENGTH statement does not help.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;33   data test;
34   length x1-x5 $16 ;
35   x1="I want to hide this";
36   x2="I want to keep this";
37   x1=SHA256HEX(strip(x1));
38   run;

NOTE: Variable x3 is uninitialized.
NOTE: Variable x4 is uninitialized.
NOTE: Variable x5 is uninitialized.
NOTE: The data set WORK.TEST has 1 observations and 5 variables.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1745436444751.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106477i004D9ED51D4FA435/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1745436444751.png" alt="Tom_0-1745436444751.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to actually make the variable the RIGHT length, which $64, not $256.&amp;nbsp; The 256 is the number of BITs, not BYTES in the SHA code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Apr 2025 19:28:01 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-04-23T19:28:01Z</dc:date>
    <item>
      <title>SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964968#M375746</link>
      <description>&lt;P&gt;When I use the SHA256HEX function and the variable length is less than 256, it appears to just spill over into other fields in the data set.&amp;nbsp; &amp;nbsp;In the code below, I would expect the 'y' variable to be identical, but it is not.&amp;nbsp; Is this expected behavior, or a bug?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
x="I want to hide this";
y="I want to keep this";
x=SHA256HEX(strip(x));
run;
proc print data=test;
run;

data test;
format x y $256.;
x="I want to hide this";
y="I want to keep this";
x=SHA256HEX(strip(x));
run;
proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; I'm using SAS 9.4 TS1M8 under 64 bit windows 10.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 16:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964968#M375746</guid>
      <dc:creator>gdb02</dc:creator>
      <dc:date>2025-04-23T16:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964969#M375747</link>
      <description>&lt;P&gt;Report it to SAS support.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 16:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964969#M375747</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-23T16:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964978#M375750</link>
      <description>&lt;P&gt;I agree you should report it to Tech Support. If you add a LENGTH statement for the variables (best practice), then I think it works as expected. Also, if you remove the STRIP function (or assign that on a different line) it seems to work. But it's unexpected behavior.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data test;
length x $ 256 y $ 256;
x="I want to hide this";
y="I want to keep this";
x=SHA256HEX(strip(x));
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 18:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964978#M375750</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2025-04-23T18:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964982#M375753</link>
      <description>&lt;P&gt;&lt;SPAN&gt;reported: ticket # CS0242442.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 19:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964982#M375753</guid>
      <dc:creator>gdb02</dc:creator>
      <dc:date>2025-04-23T19:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964987#M375755</link>
      <description>&lt;P&gt;Just the LENGTH statement does not help.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;33   data test;
34   length x1-x5 $16 ;
35   x1="I want to hide this";
36   x2="I want to keep this";
37   x1=SHA256HEX(strip(x1));
38   run;

NOTE: Variable x3 is uninitialized.
NOTE: Variable x4 is uninitialized.
NOTE: Variable x5 is uninitialized.
NOTE: The data set WORK.TEST has 1 observations and 5 variables.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1745436444751.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106477i004D9ED51D4FA435/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1745436444751.png" alt="Tom_0-1745436444751.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to actually make the variable the RIGHT length, which $64, not $256.&amp;nbsp; The 256 is the number of BITs, not BYTES in the SHA code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 19:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964987#M375755</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-23T19:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964994#M375758</link>
      <description>&lt;P&gt;My SAS 9.4M&lt;STRONG&gt;5&lt;/STRONG&gt; (on Windows &lt;STRONG&gt;7&lt;/STRONG&gt;) does not show any of these unexpected effects. All results appear to be correct.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 21:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964994#M375758</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-04-23T21:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: SHA256HEX function changes a different variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964999#M375761</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My SAS 9.4M&lt;STRONG&gt;5&lt;/STRONG&gt; (on Windows &lt;STRONG&gt;7&lt;/STRONG&gt;) does not show any of these unexpected effects. All results appear to be correct.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Same on Unix.&amp;nbsp; It works correctly with SAS 9.4 M5 but not with SAS 9.4 M7.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 23:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SHA256HEX-function-changes-a-different-variable/m-p/964999#M375761</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-23T23:45:34Z</dc:date>
    </item>
  </channel>
</rss>

