<?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: Problem importing csv file with UTF-8 encoding in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760644#M80896</link>
    <description>&lt;P&gt;You need a special option " options validvarname=any ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;
filename P1 "C:\Temp\Test_UTF_8.csv" encoding='wlatin1';
proc import datafile=P1 dbms=csv replace out=raw;
delimiter=';';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Aug 2021 13:32:01 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-08-10T13:32:01Z</dc:date>
    <item>
      <title>Problem importing csv file with UTF-8 encoding</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760616#M80895</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;I am trying to import a csv file. In this file the first line, the one containing the variables name, contains some names with utf-8 characters.&lt;/P&gt;&lt;P&gt;I'm working with SAS 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First try to import the code without considering the special characters using the "wlatin1" encoding.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename P1 "C:\Temp\Test_UTF_8.csv" encoding='wlatin1';

proc import datafile=P1 dbms=csv replace out=raw;
delimiter=';';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this case the code is working but the columns containing the special characters like "ä".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to change the encoding using "utf-8"&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename P1 "C:\Temp\Test_UTF_8.csv" encoding='utf-8';

proc import datafile=P1 dbms=csv replace out=raw;
delimiter=';';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the code is not working and I get the error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;ERROR: Invalid string.&lt;BR /&gt;FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.&lt;BR /&gt;Aborted during the INITIALIZE EXECUTION phase.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;Has someone a solution to this problem or can give me an hint where to look.&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In attachment you find the file I'm trying to import and the log file.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 12:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760616#M80895</guid>
      <dc:creator>Paolo_Corti</dc:creator>
      <dc:date>2021-08-10T12:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem importing csv file with UTF-8 encoding</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760644#M80896</link>
      <description>&lt;P&gt;You need a special option " options validvarname=any ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;
filename P1 "C:\Temp\Test_UTF_8.csv" encoding='wlatin1';
proc import datafile=P1 dbms=csv replace out=raw;
delimiter=';';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Aug 2021 13:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760644#M80896</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-10T13:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem importing csv file with UTF-8 encoding</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760653#M80897</link>
      <description>&lt;P&gt;Your file does not contain UTF-8 characters&amp;nbsp; In fact the extended ASCII characters it does have are using some of the values that UTF-8 uses to indicate multi-byte character encoding and that is what is causing the errors when you treat it as a UTF-8 encoded text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note since you are reading a text file you can just write your own data step to read the data.&amp;nbsp; Then you can control the variable names that will be used.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 13:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760653#M80897</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-10T13:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem importing csv file with UTF-8 encoding</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760656#M80898</link>
      <description>&lt;P&gt;Thank a lot for the answers!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 13:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-importing-csv-file-with-UTF-8-encoding/m-p/760656#M80898</guid>
      <dc:creator>Paolo_Corti</dc:creator>
      <dc:date>2021-08-10T13:46:10Z</dc:date>
    </item>
  </channel>
</rss>

