<?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 ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891881#M352305</link>
    <description>&lt;P&gt;I have a SAS program which imports these large JSON files which works 99.9% of the time but once a blue moon I get a JSON file which throws up the error message:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;39 filename map2 temp;&lt;BR /&gt;40 libname json2 JSON map=map2 automap=reuse ;&lt;BR /&gt;NOTE: JSON data is only read once. To read the JSON again, reassign the JSON LIBNAME.&lt;BR /&gt;ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode.&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Its not very realistic to open and interrogate the file as its to large. The best I could find was to change the encoding to be UFT-8, which SAS is already set to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below.&lt;/P&gt;&lt;P&gt;Any suggestions as to how to investigate or solve the issue please do put them as I'm at a loss.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;filename json "&amp;amp;jdir.\&amp;amp;Jfile.&amp;amp;uat..json" ;&lt;BR /&gt;
		filename json2 temp lrecl=250000;

		data _null_;
		  infile json end=eof  lrecl=250000;
		  file json2 ;
		  input ;
		  if _n_=1 then put '[' @; else put ',' @;
		  put _infile_;
		  if eof then put ']';
		run;

		filename map2 temp;
		libname json2 JSON map=map2 automap=reuse ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 08:52:09 GMT</pubDate>
    <dc:creator>94seanhogan</dc:creator>
    <dc:date>2023-08-31T08:52:09Z</dc:date>
    <item>
      <title>ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891881#M352305</link>
      <description>&lt;P&gt;I have a SAS program which imports these large JSON files which works 99.9% of the time but once a blue moon I get a JSON file which throws up the error message:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;39 filename map2 temp;&lt;BR /&gt;40 libname json2 JSON map=map2 automap=reuse ;&lt;BR /&gt;NOTE: JSON data is only read once. To read the JSON again, reassign the JSON LIBNAME.&lt;BR /&gt;ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode.&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Its not very realistic to open and interrogate the file as its to large. The best I could find was to change the encoding to be UFT-8, which SAS is already set to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below.&lt;/P&gt;&lt;P&gt;Any suggestions as to how to investigate or solve the issue please do put them as I'm at a loss.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;filename json "&amp;amp;jdir.\&amp;amp;Jfile.&amp;amp;uat..json" ;&lt;BR /&gt;
		filename json2 temp lrecl=250000;

		data _null_;
		  infile json end=eof  lrecl=250000;
		  file json2 ;
		  input ;
		  if _n_=1 then put '[' @; else put ',' @;
		  put _infile_;
		  if eof then put ']';
		run;

		filename map2 temp;
		libname json2 JSON map=map2 automap=reuse ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 08:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891881#M352305</guid>
      <dc:creator>94seanhogan</dc:creator>
      <dc:date>2023-08-31T08:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891885#M352306</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like it is related to the below SAS note:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Usage Note 64615: The SAS® log displays the error "Invalid JSON in input near line XXX column XXX: Some code points did not transcode&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/64/615.html" target="_blank"&gt;https://support.sas.com/kb/64/615.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 09:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891885#M352306</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2023-08-31T09:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Invalid JSON in input near line 15837 column 6649: Some code points did not transcode.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891923#M352321</link>
      <description>&lt;P&gt;Checking that your SAS session is UTF-8 is a good step.&amp;nbsp; After that, I think you'll have to interrogate the file to identify the problematic characters.&amp;nbsp; Without knowing which characters are causing the problem, it will be difficult to solve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your input file is apparently "JSONL" (i.e. JSON lines rather than a real JSON file) ,&amp;nbsp; that should make it easier to process the file in chunks, looking for the problematic line(s).&amp;nbsp; e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		data _null_;
		  infile json end=eof  lrecl=250000;
		  file json2 ;
		  input ;
		  if _n_=1 then put '[' @; else put ',' @;

		  if 1&amp;lt;=_n_&amp;lt;=1000 then put _infile_;  *check lines 1-1,000 of the JSON file;&lt;BR /&gt;
		  if eof then put ']';
		run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 13:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Invalid-JSON-in-input-near-line-15837-column-6649-Some/m-p/891923#M352321</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-31T13:08:35Z</dc:date>
    </item>
  </channel>
</rss>

