<?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: Tokenising a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627926#M185456</link>
    <description>&lt;P&gt;Just to add to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3480"&gt;@BillM_SAS&lt;/a&gt;&amp;nbsp;writes here a fully working self contained example.&lt;/P&gt;
&lt;P&gt;For your real data just point filename json to the source of your actual json file, remove the data _NULL_ step and things should just work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename have temp recfm=n;

data _null_;
  file have;
  infile datalines truncover;
  input;
  put _infile_;
  datalines;
[{"question":"Reference Number","answer":"5e57064595e4da0011efcde8"},
{"question":"Timestamp","answer":"Thu, 27 Feb 2020 07:59:01 AM"},
{"question":"I am","answer":"Delivery Staff"},
{"question":"Please specify other purpose of visit","answer":""},
{"question":"Going to...","answer":"Others:"},
{"question":"Location - Wards/Clinic","answer":""},
{"question":"Location-Nursing Homes/Care Centres","answer":""}]
;

libname x json "%sysfunc(pathname(have))" automap=reuse;
proc print data=x.root(drop=ordinal_root); 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Feb 2020 15:13:05 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-02-27T15:13:05Z</dc:date>
    <item>
      <title>Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627715#M185358</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i am given string like that (I need to read in from many TXT files, each text file containing a string like this)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[{"question":"Reference Number","answer":"5e57064595e4da0011efcde8"},{"question":"Timestamp","answer":"Thu, 27 Feb 2020 07:59:01 AM"},{"question":"I am","answer":"Delivery Staff"},{"question":"Please specify other purpose of visit","answer":""},{"question":"Going to...","answer":"Others:"},{"question":"Location - Wards/Clinic","answer":""},{"question":"Location-Nursing Homes/Care Centres","answer":""}]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when it is logically&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="k-pane k-scrollable"&gt;&lt;DIV class="k-widget k-splitter"&gt;&lt;DIV class="k-pane k-scrollable"&gt;&lt;DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Reference Number&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;5e57064595e4da0011efcde8&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Timestamp&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Thu, 27 Feb 2020 07:59:01 AM&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;I am&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Visitor&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Please specify other purpose of visit&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;:&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Going to...&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Others:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Location &lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;: Shop&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;},&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-top node-bracket"&gt;&lt;SPAN class="node-collapse"&gt;-&lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"question"&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class="leaf-container"&gt;&lt;SPAN class="string"&gt;Location2&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="key-node"&gt;"answer"&amp;nbsp;: Blk 1&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="key-node"&gt;&lt;SPAN&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;May i know is there a way for me to convert it into a table such that&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Each question is 1 field, answer is the value the field and i need to create a table to store the data.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;The flow is as such&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;for each TXT file,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Read in the string&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Tokenise the string&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Append the answer into Table1, where the each field represents a "question"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;I often use SAS only for basic proper table data analysis. But i do not have much knowledge about big data handling but am keen to learn the techniques.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Thank you&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="node-container"&gt;&lt;SPAN class="node-down node-bracket"&gt;&lt;SPAN class="array"&gt;Yiang&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="k-splitbar k-state-default k-splitbar-horizontal"&gt;&lt;DIV class="k-icon k-collapse-next"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="k-pane k-scrollable"&gt;&lt;DIV class="advert"&gt;&lt;DIV class="sponsored-banner"&gt;&lt;DIV class="banner-block"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="k-splitbar k-state-default k-splitbar-vertical k-splitbar-static-vertical"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="container-fluid"&gt;&lt;DIV class="pull-right"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 00:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627715#M185358</guid>
      <dc:creator>Yiang</dc:creator>
      <dc:date>2020-02-27T00:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627718#M185360</link>
      <description>&lt;P&gt;Looks like JSON.&amp;nbsp; Try using the JSON libname engine.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsglobal&amp;amp;docsetTarget=n1jfdetszx99ban1rl4zll6tej7j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=lestmtsglobal&amp;amp;docsetTarget=n1jfdetszx99ban1rl4zll6tej7j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 01:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627718#M185360</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-27T01:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627824#M185416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/314048"&gt;@Yiang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an approach to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	text ='[{"question":"Reference Number","answer":"5e57064595e4da0011efcde8"},{"question":"Timestamp","answer":"Thu, 27 Feb 2020 07:59:01 AM"},{"question":"I am","answer":"Delivery Staff"},{"question":"Please specify other purpose of visit","answer":""},{"question":"Going to...","answer":"Others:"},{"question":"Location - Wards/Clinic","answer":""},{"question":"Location-Nursing Homes/Care Centres","answer":""}]';
run;

data split;
	set have;
	length question answer $ 200;
	text = prxchange('s/\[|\]//',-1,text);
	do i=1 to countw(text,"{");
		extract = scan(text,i,"{");
		question = prxchange('s/"question":"(.*)","answer":"(.*)"\},?/$1/',1,extract);
		answer   = prxchange('s/"question":"(.*)","answer":"(.*)"\},?/$2/',1,extract);
		output;
	end;
	drop i text extract;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2020-02-27 à 10.21.27.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36424i5A623054C643DC59/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-02-27 à 10.21.27.png" alt="Capture d’écran 2020-02-27 à 10.21.27.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 09:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627824#M185416</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T09:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627916#M185453</link>
      <description>&lt;P&gt;As noted, the JSON Libname engine can handle the example data you supplied. With the example data in a text file I named JSON_SAS_COMM_627718.json, the Libname statement is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname x json './JSON_SAS_COMM_627718.json' automap=reuse;
proc print data=x.alldata(drop=p v); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produces:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                                        Obs       P1       Value

                                          1    question    Reference Number
                                          2    answer      5e57064595e4da0011efcde8
                                          3    question    Timestamp
                                          4    answer      Thu, 27 Feb 2020 07:59:01 AM
                                          5    question    I am
                                          6    answer      Delivery Staff
                                          7    question    Please specify other purpose of visit
                                          8    answer
                                          9    question    Going to...
                                         10    answer      Others:
                                         11    question    Location - Wards/Clinic
                                         12    answer
                                         13    question    Location-Nursing Homes/Care Centres
                                         14    answer&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627916#M185453</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2020-02-27T14:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627926#M185456</link>
      <description>&lt;P&gt;Just to add to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3480"&gt;@BillM_SAS&lt;/a&gt;&amp;nbsp;writes here a fully working self contained example.&lt;/P&gt;
&lt;P&gt;For your real data just point filename json to the source of your actual json file, remove the data _NULL_ step and things should just work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename have temp recfm=n;

data _null_;
  file have;
  infile datalines truncover;
  input;
  put _infile_;
  datalines;
[{"question":"Reference Number","answer":"5e57064595e4da0011efcde8"},
{"question":"Timestamp","answer":"Thu, 27 Feb 2020 07:59:01 AM"},
{"question":"I am","answer":"Delivery Staff"},
{"question":"Please specify other purpose of visit","answer":""},
{"question":"Going to...","answer":"Others:"},
{"question":"Location - Wards/Clinic","answer":""},
{"question":"Location-Nursing Homes/Care Centres","answer":""}]
;

libname x json "%sysfunc(pathname(have))" automap=reuse;
proc print data=x.root(drop=ordinal_root); 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 15:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627926#M185456</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-27T15:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Tokenising a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627935#M185462</link>
      <description>&lt;P&gt;Sorry, too much going on this morning. I printed the wrong table. The table I originally posted has the question and answers in different observations in the table. Using the ROOT table fixes that problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname x json './JSON_SAS_COMM_627718.json' automap=reuse;
proc print data=x.root(drop=ordinal_root); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Produces:&lt;/P&gt;
&lt;PRE&gt;               Obs    question                                 answer
                 1    Reference Number                         5e57064595e4da0011efcde8
                 2    Timestamp                                Thu, 27 Feb 2020 07:59:01 AM
                 3    I am                                     Delivery Staff
                 4    Please specify other purpose of visit
                 5    Going to...                              Others:
                 6    Location - Wards/Clinic
                 7    Location-Nursing Homes/Care Centres&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 15:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Tokenising-a-string/m-p/627935#M185462</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2020-02-27T15:09:58Z</dc:date>
    </item>
  </channel>
</rss>

