<?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 Reading Unicode from Snowflake into SAS via ODBC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892020#M352364</link>
    <description>&lt;P&gt;In a SAS Unicode session, data from Snowflake is coming across as iso-8859-1, even though the SAS data set marks the data set as Unicode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I connect using&lt;/P&gt;&lt;PRE&gt;libname mysf odbc
complete="DRIVER={SnowflakeDSIIDriver};SERVER=...";&lt;/PRE&gt;&lt;P&gt;I can use PROC DATASETS with CORRECTENCODING to change the data set to iso-8559-1, and then compatible characters (like Spanish and German) look okay. However, non-compatible characters (like Japanese) are always mojibaked or missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am on SAS Unicode 32-bit and Windows 10 Enterprise .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: SAS (r) Proprietary Software 9.4 (TS1M7 MBCS3170)&lt;BR /&gt;NOTE: This session is executing on the W32_10PRO platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Snowflake 32-bit ODBC driver:&amp;nbsp;2.25.04.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would rather not pay for a Snowflake connector license just for this one feature.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 17:46:01 GMT</pubDate>
    <dc:creator>AndrewZ</dc:creator>
    <dc:date>2023-08-31T17:46:01Z</dc:date>
    <item>
      <title>Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892020#M352364</link>
      <description>&lt;P&gt;In a SAS Unicode session, data from Snowflake is coming across as iso-8859-1, even though the SAS data set marks the data set as Unicode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I connect using&lt;/P&gt;&lt;PRE&gt;libname mysf odbc
complete="DRIVER={SnowflakeDSIIDriver};SERVER=...";&lt;/PRE&gt;&lt;P&gt;I can use PROC DATASETS with CORRECTENCODING to change the data set to iso-8559-1, and then compatible characters (like Spanish and German) look okay. However, non-compatible characters (like Japanese) are always mojibaked or missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am on SAS Unicode 32-bit and Windows 10 Enterprise .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: SAS (r) Proprietary Software 9.4 (TS1M7 MBCS3170)&lt;BR /&gt;NOTE: This session is executing on the W32_10PRO platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Snowflake 32-bit ODBC driver:&amp;nbsp;2.25.04.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would rather not pay for a Snowflake connector license just for this one feature.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 17:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892020#M352364</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2023-08-31T17:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892222#M352412</link>
      <description>&lt;P&gt;I'm bit confused since Snowflake claims that they always have the data transferred in UTF-8 using their ODBC driver.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.snowflake.com/s/article/Does-the-Snowflake-ODBC-Driver-support-non-Latin-characters" target="_blank"&gt;https://community.snowflake.com/s/article/Does-the-Snowflake-ODBC-Driver-support-non-Latin-characters&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the actual ENCODING setting in your SAS session?&lt;/P&gt;
&lt;P&gt;Make sure that you download the data to a clean location to avoid encoding miss-match.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 08:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892222#M352412</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-01T08:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892341#M352438</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"proc options option=encoding; run;" tells me my encoding is UTF-8, and when I check the properties of the SAS data set under WORK (created by querying Snowflake), the encoding is UTF-8 too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What do you mean a clean location? I am creating a v9 SAS data in WORK.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 16:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892341#M352438</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2023-09-01T16:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892379#M352439</link>
      <description>&lt;P&gt;Sounds like the data in the Snowflake database is not UTF-8?&lt;/P&gt;
&lt;P&gt;Try a small query with some characters that you know are non-7bit ASCII characters and print the actual hex codes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set mysf.have(encoding=any);
  put (_character_) (=$hex. /);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 20:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892379#M352439</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-01T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892387#M352440</link>
      <description>&lt;P&gt;I created a Unicode table in Snowflake via DBeaver with this code&lt;/P&gt;&lt;PRE&gt;create or replace TABLE zzz_unicode ( language_code int, text varchar(100) );
insert into zzz_unicode (language_code, text) values
(1, 'Ich kann Glasssplitter essen, es tut mir nicht weh'),
(2, 'Je peux manger du verre, ça ne me fait pas mal'),
(3, 'Posso mangiare vetro, non mi fa male'),
(4, 'Eu posso comer vidro, não me faz mal'),
(5, 'Puedo comer vidrio, no me hace daño'),
(6, 'Я могу есть битое стекло, оно мне не вредит'),
(7, 'ฉันสามารถกินแก้วแตกได้ มันไม่ทำให้ฉันเจ็บปวด'),
(8, '私は割れたガラスを食べることができます、それは私を傷つけません'),
(9, 'እኔ የተሰነጠቀ ብረት መብላት እችላለሁ፣ አይጎዳኝም'),
(10, 'ငါ ብስጭት መብላት እችላለሁ, ጎጂ አይደለም');
insert into zzz_unicode (language_code, text) values
(11, 'Я могу есть битое стекло, оно мне не вредит'),
(12, '私は割れたガラスを食べることができます、それは私を傷つけません'),
(13, '我可以吃碎玻璃，它不会伤害我');

select *
from zzz_unicode
;&lt;/PRE&gt;&lt;P&gt;This shows how the table looks in DBeaver (looks good) vs SAS PROC PRINT (looks bad).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="I can eat broken glass.png" style="width: 880px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87562iFD437EFC99912DF9/image-size/large?v=v2&amp;amp;px=999" role="button" title="I can eat broken glass.png" alt="I can eat broken glass.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the SAS log for the HEX test you suggested. The character 1A is SUB, and 20 is space, so we see the mojibake in HEX too. Also, it doesn't like encoding=any.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;348
349 data test;
350 set jet.zzz_unicode(encoding=any);
--------
76
WARNING 76-63: The option ENCODING is not implemented in the ODBC engine.

351 if language_code in (6,13);
352 put (text) (=$hex. /);
353 run;

TEXT=1A201A1A1A1A201A1A1A1A201A1A1A1A1A201A1A1A1A1A1A2C201A1A1A201A1A1A201A1A201A1A1A1A1A1A20202020202020202020202020202020202020202020202020202020202
0202020202020202020202020202020202020202020202020202020
TEXT=1A1A1A1A1A1A1A1A1A1A1A1A1A1A202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202
0202020202020202020202020202020202020202020202020202020&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2023 20:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892387#M352440</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2023-09-01T20:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892390#M352441</link>
      <description>&lt;P&gt;Try tweaking the ODBC definition.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/ODBC-to-Postgres-DB-is-translating-UTF-8-data-into-Latin1/td-p/747543" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/ODBC-to-Postgres-DB-is-translating-UTF-8-data-into-Latin1/td-p/747543&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 21:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892390#M352441</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-01T21:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892392#M352442</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I change the ODBC definition for Snowflake? The URL you posted was about PostgreSQL, and in the last comment, the author (not the original poster) wrote that he solved by adding "&lt;SPAN&gt;SET CLIENT_ENCODING TO 'UTF8'" to his connection string, but I see no such option for Snowflake. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;posted a link to Snowflake documentation that states:&amp;nbsp;"the Snowflake ODBC Driver will &lt;EM&gt;always&lt;/EM&gt; use UTF-8 encoding for any STRING/VARCHAR/VARIANT type column data."&amp;nbsp;This is what I need, and I can't change it.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Also, I do not see any encoding related options in Snowflake &lt;A href="https://docs.snowflake.com/en/sql-reference/parameters" target="_self"&gt;session parameters&lt;/A&gt; or &lt;A href="https://docs.snowflake.com/developer-guide/odbc/odbc-parameters" target="_self"&gt;ODBC parameters&lt;/A&gt;. This is consistent with the documentation the the "ODBC driver will always use UTF-8" because there is no way to change it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because Snowflake always uses UTF-8 leads me to conclude that the problem, whether SAS configuration or SAS bug, is with SAS's ODBC integration.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 22:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892392#M352442</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2023-09-01T22:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892394#M352443</link>
      <description>&lt;P&gt;Did you raise a ticket with SAS support?&lt;/P&gt;
&lt;P&gt;I am also surprised to see that you are using 32-bit version of SAS.&lt;/P&gt;
&lt;P&gt;Do you have access to 64-bit version of SAS and 64-bit ODBC drivers for snowflake that you can test?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 23:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892394#M352443</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-01T23:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892395#M352444</link>
      <description>&lt;P&gt;The other work around is to dump the data to a text file and then read the text file using a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like Snowflake has a COPY TO command for generating text files from data.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.snowflake.com/en/sql-reference/sql/copy-into-location" target="_blank" rel="noopener"&gt;https://docs.snowflake.com/en/sql-reference/sql/copy-into-location&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steps would be:&lt;BR /&gt;1) Generate delimited text file.&lt;/P&gt;
&lt;P&gt;2) Make the text file available to SAS. Might involve copying the file from S3 to work directory.&lt;/P&gt;
&lt;P&gt;2) Create dataset with same structure as original table (could be as simple as using OBS=0 dataset option) and then read in the text file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Step 3 ;
data want;
   if 0 then set snow.mytable (obs=0);
   infile csv dsd truncover ;
   input (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For large files you might find that it works much faster than trying to suck data though that tiny ODBC straw.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 23:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892395#M352444</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-01T23:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892537#M352509</link>
      <description>Yes, that's is as clean as it gets.&lt;BR /&gt;Following &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; here, SAS Support could be your next step.&lt;BR /&gt;Another thing to try is to open this data from another application on your computer, like Excel and compare.</description>
      <pubDate>Mon, 04 Sep 2023 11:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/892537#M352509</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-04T11:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/893051#M352770</link>
      <description>&lt;P&gt;OK, I opened a ticket with SAS support. Let's see how that goes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The COPY TO is a creative suggestion. I already do the opposite for bulk loading data into Snowflake, so if I get desperate, I will check into that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could also write a Python program to read the data from Snowflake and pass it to SAS. Python can write SAS format via sas7bdat, but I am guessing it doesn't support Unicode. Maybe XLSX or Access would be the easiest way. This doesn't seem fun, either.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 00:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/893051#M352770</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2023-09-07T00:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/893160#M352832</link>
      <description>&lt;P&gt;Interesting thread, thanks.&amp;nbsp; Looking forward to hearing what SAS support says.&amp;nbsp; Also just want to say, XLSX is never the answer, and it's usually the problem.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To the big picture, have you tried using snowflake's ODBC driver with some other client (e.g. python, or, ok, even Excel), to see what comes down? If other clients have the same problem, then I think you've got to point back to snowflake support. Just because their docs say they always serve UTF-8 doesn't mean they are.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 13:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/893160#M352832</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-09-07T13:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935862#M367910</link>
      <description>&lt;P&gt;Any response from tech Support on this? I'm having the same issue (I think).&amp;nbsp; &amp;nbsp;Running SAS 9.4M7 (64-bit) on Windows.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 20:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935862#M367910</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-07-15T20:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935864#M367911</link>
      <description>&lt;P&gt;I've pursued this with official SAS support, Snowflake support, unofficial channels like this online forum, and our IT department. SAS and Snowflake pointed fingers at each other, and I haven't gotten anywhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on some tests like the Microsoft ODBC Test utility in the MDAC package, the problem seems to be that the Snowflake driver never returns UTF-8, despite what Snowflake documentation states. This low-level utility is not user friendly, but easier ways to demonstrate that the problem is with the Snowflake ODBC driver are to use other ODBC clients such as Microsoft Excel or Microsoft Access.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The test procedure is simple: just create a table with a little bit of data, and then use a client like Excel to query it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;create or replace TABLE zzz_unicode ( language_code int, text varchar(100) );

insert into zzz_unicode (language_code, text) values

(1, 'Ich kann Glasssplitter essen, es tut mir nicht weh'),

(2, 'Je peux manger du verre, ça ne me fait pas mal'),

(3, 'Posso mangiare vetro, non mi fa male'),

(4, 'Eu posso comer vidro, não me faz mal'),

(5, 'Puedo comer vidrio, no me hace daño'),

(6, 'Я могу есть битое стекло, оно мне не вредит'),

(7, 'ฉันสามารถกินแก้วแตกได้ มันไม่ทำให้ฉันเจ็บปวด'),

(8, '私は割れたガラスを食べることができます、それは私を傷つけません'),

(9, 'እኔ የተሰነጠቀ ብረት መብላት እችላለሁ፣ አይጎዳኝም'),

(10, 'ငါ ብስጭት መብላት እችላለሁ, ጎጂ አይደለም');

insert into zzz_unicode (language_code, text) values

(11, 'Я могу есть битое стекло, оно мне не вредит'),

(12, '私は割れたガラスを食べることができます、それは私を傷つけません'),

(13, '我可以吃碎玻璃，它不会伤害我');

&amp;nbsp;

select *

from zzz_unicode

;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you make progress, let me know please.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 20:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935864#M367911</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2024-07-15T20:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935872#M367912</link>
      <description>&lt;P&gt;Is your session encoding UTF-8?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option = encoding;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jul 2024 23:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935872#M367912</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-07-15T23:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935961#M367929</link>
      <description>&lt;P&gt;Quentin, I did extensive testing on this issue in SAS and other tools. In SAS, I used SAS Unicode (utf-8) and SAS English (wlatin1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My workaround in SAS Unicode is to run PROC DATASETS like below every time I pull in data from Snowflake, but it only gives me iso-8859-1, which seems to be a limitation of the Snowflake ODBC driver.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc datasets library=&amp;amp;lib noprint;&lt;BR /&gt;modify &amp;amp;ds / correctencoding='iso-8859-1';&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 21:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/935961#M367929</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2024-07-16T21:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936075#M367974</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18182"&gt;@AndrewZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Quentin, I did extensive testing on this issue in SAS and other tools. In SAS, I used SAS Unicode (utf-8) and SAS English (wlatin1).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My workaround in SAS Unicode is to run PROC DATASETS like below every time I pull in data from Snowflake, but it only gives me iso-8859-1, which seems to be a limitation of the Snowflake ODBC driver.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets library=&amp;amp;lib noprint;&lt;BR /&gt;modify &amp;amp;ds / correctencoding='iso-8859-1';&lt;BR /&gt;quit;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not sure what your second paragraph means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you look at the hexcodes in the dataset?&amp;nbsp; Were they the valid UTF-8 bytes you expected?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That PROC DATASETS code will just change the metadata attribute that indicates the encoding used to create the file.&amp;nbsp; Changing the metadata about the encoding of the text in the dataset will not change what is in the dataset.&amp;nbsp; It just tells future users of the data what to expect to find when they look at the data.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 19:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936075#M367974</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-07-17T19:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936086#M367978</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18182"&gt;@AndrewZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried this Libname option?&lt;/P&gt;
&lt;P&gt;&lt;A title="DBCLIENT_MAX_BYTES= LIBNAME Statement Option" href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n03byaxn5439w5n1ev20fyqk0uaf.htm" target="_self"&gt;DBCLIENT_MAX_BYTES= LIBNAME Statement Option&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One think to keep in mind, Variable length in Snowflake are based on character count, while in SAS, they are based on Byte count!&lt;/P&gt;
&lt;P&gt;Therefore what could be stored in Snowflake within a char/varchar (1) may require a SAS variable of length 2+ in order to correctly display the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 20:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936086#M367978</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2024-07-17T20:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936094#M367982</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;Did you look at the hexcodes in the dataset?&amp;nbsp; Were they the valid UTF-8 bytes you expected?&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You mean use a hex editor on the .sas7bdat file? No. Based on my other tests (like one in the next paragraph), Snowflake was not sending UTF-8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;That PROC DATASETS code will just change the metadata attribute that indicates the encoding used to create the file.&amp;nbsp; Changing the metadata about the encoding of the text in the dataset will not change what is in the dataset.&amp;nbsp; It just tells future users of the data what to expect to find when they look at the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Yes, I understand. The PROC DATASETS step fixed encoding for Spanish&amp;nbsp;characters (like á, é, í, ó, ú, ñ), German characters ( like ä, ö, ü), and "smart" quotation marks usually made by Microsoft Office, but not other texts like Korean, so that implies Snowflake ODBC was sending the text as iso-8859-1 instead of utf-8.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;If Snowflake ODBC were sending UTF-8, PROC DATASETS would not have this effect in SAS.&lt;/DIV&gt;</description>
      <pubDate>Wed, 17 Jul 2024 20:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936094#M367982</guid>
      <dc:creator>AndrewZ</dc:creator>
      <dc:date>2024-07-17T20:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Unicode from Snowflake into SAS via ODBC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936117#M367986</link>
      <description>&lt;P&gt;Thanks much for your response.&amp;nbsp; Really appreciate it.&amp;nbsp; Your diagnostic steps sounds good to me.&amp;nbsp; Unfortunately I can't test myself, as I currently have only read access to a table that was recently migrated from SQL Server to Snowflake.&amp;nbsp; In my quick PROC COMPARE I noticed the problems caused by the encoding, even after I ran the query against snowflake in a SAS UTF-8 session.&amp;nbsp; Then google led me to your post.&amp;nbsp; Unfortunately, I have characters in many many multi-byte languages, so sounds like the&amp;nbsp;&lt;SPAN&gt;iso-8859-1 encoding won't fix it all.&amp;nbsp; I'll probably open up a ticket with the internal IT group that owns the snowflake instance, but they'll probably just tell me it's a SAS problem and close the ticket, because they don't know SAS.&amp;nbsp; : )&amp;nbsp; &amp;nbsp;In the end it's okay, I don't really need the character strings that have issues, was just hoping for an easy way to make the PROC COMPARE return 0 differences.&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 01:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Unicode-from-Snowflake-into-SAS-via-ODBC/m-p/936117#M367986</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-07-18T01:48:57Z</dc:date>
    </item>
  </channel>
</rss>

