<?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: How do I Read Multiple Delimited Single line file in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511052#M2094</link>
    <description>&lt;P&gt;Thanks for your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried the above code and getting an error as&lt;/P&gt;&lt;P&gt;"The JSON engine cannot be found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are currently using SAS 9.3&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 15:21:39 GMT</pubDate>
    <dc:creator>anandrc</dc:creator>
    <dc:date>2018-11-07T15:21:39Z</dc:date>
    <item>
      <title>How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510809#M2029</link>
      <description>&lt;P&gt;Hello, I have a text file with data in single line and with multiple delimiter. The file starts with [ and ends with ]. The file is huge but An example is shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we read this formatted file in SAS? Any recommendation is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[{"seq":24425,"acc":"1-1951","Date":"26-08-2018"},{"seq":24426,"acc":"1-1952","Date":"27-08-2018"},{"seq":24427,"acc":"1-1953","Date":"28-08-2018"}]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, the sas dataset should be as&lt;/P&gt;&lt;P&gt;seq&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&lt;/P&gt;&lt;P&gt;24425 1-1951 26-08-2018&lt;/P&gt;&lt;P&gt;24426 1-1952 27-08-2018&lt;/P&gt;&lt;P&gt;24427 1-1953 28-08-2018&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 16:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510809#M2029</guid>
      <dc:creator>anandrc</dc:creator>
      <dc:date>2018-11-06T16:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510816#M2030</link>
      <description>&lt;P&gt;If that is JSON then you should look at the LIBNAME JSON statement and options. It may say you many headaches.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 16:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510816#M2030</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-06T16:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510817#M2031</link>
      <description>&lt;P&gt;That looks like JSON. Try reading it with &lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p06hstivs0b3hsn1cb4zclxukkut.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC JSON&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If every record has every field then just read directly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tall ;
  row+1;
  do col=1 to 3;
    length name $32 value $50 ;
    infile cards dlm='[]{},:' ;
    input name value @@;
    name=dequote(name);
    value=dequote(value);
    output;
  end;
cards4;
[{"seq":24425,"acc":"1-1951","Date":"26-08-2018"},{"seq":24426,"acc":"1-1952","Date":"27-08-2018"},{"seq":24427,"acc":"1-1953","Date":"28-08-2018"}]
;;;;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    row    col    name    value

 1      1      1     seq     24425
 2      1      2     acc     1-1951
 3      1      3     Date    26-08-2018
 4      2      1     seq     24426
 5      2      2     acc     1-1952
 6      2      3     Date    27-08-2018
 7      3      1     seq     24427
 8      3      2     acc     1-1953
 9      3      3     Date    28-08-2018&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 16:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510817#M2031</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-06T16:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510839#M2038</link>
      <description>&lt;P&gt;The JSON procedure is output only. To read in that JSON looking data, try using the &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsglobal&amp;amp;docsetTarget=n1jfdetszx99ban1rl4zll6tej7j.htm&amp;amp;locale=en" target="_self"&gt;JSON LIBNAME statement&lt;/A&gt;, as others have suggested.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 17:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510839#M2038</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2018-11-06T17:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510841#M2039</link>
      <description>&lt;P&gt;I put your example data line into the file json.txt and used it in the JSON LIBNAME statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test json ".\sasuser\json.txt" 
                  map=".\sasuser\json.map" automap=reuse;
run;

proc print data=test.root(drop=ordinal_root); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The results are what you desired:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set TEST.ROOT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;seq&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;acc&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Date&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;24425&lt;/TD&gt;
&lt;TD class="l data"&gt;1-1951&lt;/TD&gt;
&lt;TD class="l data"&gt;26-08-2018&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;24426&lt;/TD&gt;
&lt;TD class="l data"&gt;1-1952&lt;/TD&gt;
&lt;TD class="l data"&gt;27-08-2018&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;24427&lt;/TD&gt;
&lt;TD class="l data"&gt;1-1953&lt;/TD&gt;
&lt;TD class="l data"&gt;28-08-2018&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Nov 2018 17:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/510841#M2039</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2018-11-06T17:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511052#M2094</link>
      <description>&lt;P&gt;Thanks for your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried the above code and getting an error as&lt;/P&gt;&lt;P&gt;"The JSON engine cannot be found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are currently using SAS 9.3&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 15:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511052#M2094</guid>
      <dc:creator>anandrc</dc:creator>
      <dc:date>2018-11-07T15:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511053#M2095</link>
      <description>&lt;P&gt;Sorry. I forgot to mention you need SAS 9.4 maintenance 4 or better to have access to the JSON engine.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 15:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511053#M2095</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2018-11-07T15:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Read Multiple Delimited Single line file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511915#M2275</link>
      <description>We are upgrading to SAS 9.4. I will try the solution once we have 9.4. But thank you all for your assistance.&lt;BR /&gt;Much appreciated.</description>
      <pubDate>Sat, 10 Nov 2018 09:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-Read-Multiple-Delimited-Single-line-file/m-p/511915#M2275</guid>
      <dc:creator>anandrc</dc:creator>
      <dc:date>2018-11-10T09:06:33Z</dc:date>
    </item>
  </channel>
</rss>

