<?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 How to migrate SAS 9.4 latin1 codes into Viya utf-8 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-migrate-SAS-9-4-latin1-codes-into-Viya-utf-8/m-p/828967#M327485</link>
    <description>&lt;P&gt;In SAS9.4 there is a rule 1 byte = 1 character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Viya comes with Utf-8 and this rule no longer working. In utf-8 special characters can use 2,3,4 bytes, and some of the "standard" functions from SAS9.4 are not working in Viya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;K-functions are described here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1902-2018.pdf" target="_self"&gt;https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1902-2018.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/nlsref/p0ydidiqibf0vbn1jljj1cv9men9.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/nlsref/p0ydidiqibf0vbn1jljj1cv9men9.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When we run the following code in SAS9.4 and SAS Viya 3.5 we'll see different results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA test;
  name = 'éàè@&amp;amp;ùµ';
  len = LENGTH(name);
  sub = SUBSTR(name,5);
  klen = KLENGTH(name);  
  ksub = KSUBSTR(name,5);
RUN;  
proc print data=test; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result in SAS9.4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="idziemianczyk_0-1660721864069.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74480i52814594D401449F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="idziemianczyk_0-1660721864069.png" alt="idziemianczyk_0-1660721864069.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The result in SAS Viya 3.5&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="idziemianczyk_1-1660721885696.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74481i94481D2E944A264D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="idziemianczyk_1-1660721885696.png" alt="idziemianczyk_1-1660721885696.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we can see, very popular functions like LENGTH or SUBSTR return the wrong results in Viya and we should use KLENGTH and KSUBSTR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;Are there any other ways to migrate code from SAS9.4 to Viya3.5 without changing all non-K-Functions to K-Functions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At that moment it seems that&amp;nbsp;backward compatibility doesn't work between SAS 9.4 code and SAS Viya 3.5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 07:43:37 GMT</pubDate>
    <dc:creator>idziemianczyk</dc:creator>
    <dc:date>2022-08-17T07:43:37Z</dc:date>
    <item>
      <title>How to migrate SAS 9.4 latin1 codes into Viya utf-8</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-migrate-SAS-9-4-latin1-codes-into-Viya-utf-8/m-p/828967#M327485</link>
      <description>&lt;P&gt;In SAS9.4 there is a rule 1 byte = 1 character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Viya comes with Utf-8 and this rule no longer working. In utf-8 special characters can use 2,3,4 bytes, and some of the "standard" functions from SAS9.4 are not working in Viya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;K-functions are described here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1902-2018.pdf" target="_self"&gt;https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1902-2018.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/nlsref/p0ydidiqibf0vbn1jljj1cv9men9.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/nlsref/p0ydidiqibf0vbn1jljj1cv9men9.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When we run the following code in SAS9.4 and SAS Viya 3.5 we'll see different results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA test;
  name = 'éàè@&amp;amp;ùµ';
  len = LENGTH(name);
  sub = SUBSTR(name,5);
  klen = KLENGTH(name);  
  ksub = KSUBSTR(name,5);
RUN;  
proc print data=test; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result in SAS9.4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="idziemianczyk_0-1660721864069.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74480i52814594D401449F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="idziemianczyk_0-1660721864069.png" alt="idziemianczyk_0-1660721864069.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The result in SAS Viya 3.5&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="idziemianczyk_1-1660721885696.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74481i94481D2E944A264D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="idziemianczyk_1-1660721885696.png" alt="idziemianczyk_1-1660721885696.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we can see, very popular functions like LENGTH or SUBSTR return the wrong results in Viya and we should use KLENGTH and KSUBSTR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;Are there any other ways to migrate code from SAS9.4 to Viya3.5 without changing all non-K-Functions to K-Functions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At that moment it seems that&amp;nbsp;backward compatibility doesn't work between SAS 9.4 code and SAS Viya 3.5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 07:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-migrate-SAS-9-4-latin1-codes-into-Viya-utf-8/m-p/828967#M327485</guid>
      <dc:creator>idziemianczyk</dc:creator>
      <dc:date>2022-08-17T07:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to migrate SAS 9.4 latin1 codes into Viya utf-8</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-migrate-SAS-9-4-latin1-codes-into-Viya-utf-8/m-p/828985#M327490</link>
      <description>&lt;P&gt;From the docs of length:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;The LENGTH function returns a length in bytes&lt;/STRONG&gt;. The KLENGTH function returns a length in a character-based unit.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So length returns the correct value in both environments, unfortunately many sas user (including myself) have ignored the fact, that the result depends on the encoding. Our 9.4 environment hast two SASApps, one for latin1 the other one for utf-8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Are there any other ways to migrate code from SAS9.4 to Viya3.5 without changing all non-K-Functions to K-Functions?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Afaik there is no other way.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 10:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-migrate-SAS-9-4-latin1-codes-into-Viya-utf-8/m-p/828985#M327490</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-08-17T10:18:06Z</dc:date>
    </item>
  </channel>
</rss>

