<?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 import a csv file changing the default delimiter. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794983#M32885</link>
    <description>&lt;P&gt;Hello everyone, I'm new to sas programming and I would like to import 4 csv files that have this delimiter: || and I would like to change it to this |""|.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how could i do it? I have tried with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import file="xxxxxxx\xxxx.csv"&amp;nbsp;&lt;BR /&gt;out=work.test&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|""|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it gives to me this errors:&lt;/P&gt;&lt;P&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Invalid open mode.&lt;BR /&gt;ERROR: Import unsuccessful. See SAS Log for details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone could help me I would be very grateful&lt;/P&gt;</description>
    <pubDate>Tue, 08 Feb 2022 14:12:51 GMT</pubDate>
    <dc:creator>Abelp9</dc:creator>
    <dc:date>2022-02-08T14:12:51Z</dc:date>
    <item>
      <title>How to import a csv file changing the default delimiter.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794983#M32885</link>
      <description>&lt;P&gt;Hello everyone, I'm new to sas programming and I would like to import 4 csv files that have this delimiter: || and I would like to change it to this |""|.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how could i do it? I have tried with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import file="xxxxxxx\xxxx.csv"&amp;nbsp;&lt;BR /&gt;out=work.test&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|""|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it gives to me this errors:&lt;/P&gt;&lt;P&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Some code points have not been transcoded.&lt;BR /&gt;ERROR: Invalid open mode.&lt;BR /&gt;ERROR: Import unsuccessful. See SAS Log for details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone could help me I would be very grateful&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794983#M32885</guid>
      <dc:creator>Abelp9</dc:creator>
      <dc:date>2022-02-08T14:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a csv file changing the default delimiter.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794985#M32886</link>
      <description>&lt;P&gt;A delimiter is a single character.&amp;nbsp; You can use multiple characters as delimiters, but that just means that each individual character in the delimiter list string is treated as delimiter.&amp;nbsp; You appear to be trying to say that your file is using a four character string as the delimiter.&amp;nbsp; Two vertical bar characters around two double quote characters.&amp;nbsp; If that is really how the file is built you will need to use the DLMSTR= option on the INFILE statement and not the DLM= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But your error messages are about the ENCODING of the file and not how the fields are delimited.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the encoding option for your SAS session by checking the ENCODING system option.&amp;nbsp; You can try either of these two methods to check:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=encoding; run;

%put %sysfunc(getoption(encoding));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make sure you can handle any encoding that the file might be using you should be running your SAS session with ENCODING=UTF-8.&amp;nbsp; If you are using some single byte encoding, like WLATIN1, then there are only 256 possible characters that encoding can reprsesent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To override the encoding that SAS will use to read the file use the ENCODING= option on the INFILE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check what your file really has in it look at it as a binary file and dump some of it to the SAS log.&amp;nbsp; This data step will dump the first 500 bytes from the file to the SAS log so you can check what it actually contains.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   infile "xxxxxxx\xxxx.csv"  recfm=f lrecl=100 obs=5 ;
   input;
   list;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794985#M32886</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-08T14:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a csv file changing the default delimiter.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794988#M32887</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Would something like this be?&lt;/SPAN&gt; &lt;SPAN class=""&gt;It keeps giving me errors everywhere so I guess not, but what is the function of DLMSTR = ?&lt;/SPAN&gt; &lt;SPAN class=""&gt;SAS does not recognize it and I do not know if I am putting it correctly in the encoding&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import file="xxxxxx\xxxx.csv"&lt;BR /&gt;ENCODING= UTF-8&lt;BR /&gt;out=work.test&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;DLMSTR ='|""|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794988#M32887</guid>
      <dc:creator>Abelp9</dc:creator>
      <dc:date>2022-02-08T14:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a csv file changing the default delimiter.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794993#M32888</link>
      <description>&lt;P&gt;Read the file yourself.&amp;nbsp; Don't ask PROC IMPROT to guess how to read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this to see what the first few lines look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  infile "xxxxxx\xxxx.csv" obs=5;
  input;
  list;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if it really looks like it is using the multiple byte string between the fields then try this to read in some of the values and look at them.&lt;/P&gt;
&lt;P&gt;This will read the first 10 fields from the first 10 lines as character strings (truncated to 50 bytes each) and then print it so you can examine what the fields look like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ;
  infile "xxxxxx\xxxx.csv" truncover obs=10 DLMSTR ='|""|';
  input (v1-v10) (:$50.);
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/794993#M32888</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-08T14:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a csv file changing the default delimiter.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/795014#M32900</link>
      <description>&lt;P&gt;If you did want to try using PROC IMPORT perhaps you should first convert the file to a normal CSV file instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile original dlmstr='|""|' length=ll column=cc truncover ;
  file new dsd ;
  do until(cc&amp;gt;ll);
    input value :$32767. @;
    put value @;
  end;
  put;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 16:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-csv-file-changing-the-default-delimiter/m-p/795014#M32900</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-08T16:30:21Z</dc:date>
    </item>
  </channel>
</rss>

