<?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: Extract informations in serialised data. in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851110#M16777</link>
    <description>&lt;P&gt;Hi SASKiwi,&lt;/P&gt;
&lt;P&gt;thanks for your answer.&lt;/P&gt;
&lt;P&gt;Here is your code with my sample data&amp;nbsp; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Have;&lt;BR /&gt;input @1 MyField $500.;&lt;BR /&gt;datalines;&lt;BR /&gt;a:2:{i:0;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT020";}s:10:"percentage";a:3:{s:4:"name";s:10:"percentage";s:4:"type";s:13:"quantityValue";s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}i:1;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT021";}s:10:"percentage";a:3:{s:4:"name";s:10:"percentage";s:4:"type";s:13:"quantityValue";s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}}&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run this code, I've got some errors with this message&amp;nbsp; :&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Michel.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Dec 2022 07:54:59 GMT</pubDate>
    <dc:creator>Genesis007</dc:creator>
    <dc:date>2022-12-26T07:54:59Z</dc:date>
    <item>
      <title>Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/850924#M16775</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;
&lt;P&gt;In a specific field from my database, I've got a serialized informations that I would like to parse.&lt;/P&gt;
&lt;P&gt;The string looks like something like that :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Genesis007_0-1671785396089.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78838iCEC233C3E3F80DD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Genesis007_0-1671785396089.png" alt="Genesis007_0-1671785396089.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I need to extract the highlighted informations. In each field I can have more than one "MATXXX" info and I need to create a new table with these informations.&lt;/P&gt;
&lt;P&gt;I've seen some example on the forum with regular expression, but I don't understand how to use them.&lt;/P&gt;
&lt;P&gt;Help me please !&lt;/P&gt;
&lt;P&gt;Best rergards,&lt;/P&gt;
&lt;P&gt;Michel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 08:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/850924#M16775</guid>
      <dc:creator>Genesis007</dc:creator>
      <dc:date>2022-12-23T08:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851013#M16776</link>
      <description>&lt;P&gt;Can you post some sample data in a DATA step using DATALINES please? You can't copy and paste from screenshots. It will look something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
  input @1 MyField $500.;
  datalines;
&amp;lt;paste your sample data here&amp;gt;
;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2022 22:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851013#M16776</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-12-23T22:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851110#M16777</link>
      <description>&lt;P&gt;Hi SASKiwi,&lt;/P&gt;
&lt;P&gt;thanks for your answer.&lt;/P&gt;
&lt;P&gt;Here is your code with my sample data&amp;nbsp; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Have;&lt;BR /&gt;input @1 MyField $500.;&lt;BR /&gt;datalines;&lt;BR /&gt;a:2:{i:0;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT020";}s:10:"percentage";a:3:{s:4:"name";s:10:"percentage";s:4:"type";s:13:"quantityValue";s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}i:1;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT021";}s:10:"percentage";a:3:{s:4:"name";s:10:"percentage";s:4:"type";s:13:"quantityValue";s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}}&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run this code, I've got some errors with this message&amp;nbsp; :&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Michel.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 07:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851110#M16777</guid>
      <dc:creator>Genesis007</dc:creator>
      <dc:date>2022-12-26T07:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851116#M16778</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
infile datalines truncover;
input  MyField $500.;
datalines4;
a:2:{i:0;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT020";}s:10:"percentage";a:3:{s:4:"name";s:10:"percentage";s:4:"type";s:13:"quantityValue";
s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}i:1;a:2:{s:8:"material";a:3:{s:4:"name";s:8:"material";s:4:"type";s:5:"input";s:4:"data";s:6:"MAT021";}s:10:"percentage";a:3:{s:4:"name";
s:10:"percentage";s:4:"type";s:13:"quantityValue";s:4:"data";a:2:{s:5:"value";N;s:6:"unitId";s:1:"1";}}}}
;;;;
run;
data want;
 set have;
pid=prxparse('/MAT\d+/io');
s=1;e=length(myfield);
call prxnext(pid,s,e,myfield,p,l);
do while(p&amp;gt;0);
 want=substr(myfield,p,l);output;
 call prxnext(pid,s,e,myfield,p,l);
end;
drop pid s e p l;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Dec 2022 09:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851116#M16778</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-12-26T09:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851125#M16779</link>
      <description>&lt;P&gt;Hi Ksharp,&lt;/P&gt;
&lt;P&gt;thanks for your answer.&lt;BR /&gt;I've got my result !! Thanks a lot !&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Can you confirm that I understood your code correctly?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;In the first part of the code, your goal is to create a dataset with the information contained in my string.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;The second part will search the regular expression defined in the PID variable, with the prxparse function (a string with MAT, and an undefined number of digits ??)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;s is the start point of the search in the string, e is the length of the string.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;call prxnext launch the search of the "pid" in "myfield", from start position defined in s, to the length of "myfield".&lt;BR /&gt;The function return the starting position (p) of my string and its length (l). I think if there's no match found, the prxnext function return a p value &amp;lt; 0 ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;With the substr instruction, I just have to extract the part of the string corresponding to the start point of the substring and its length returned by the prxnext...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;Is it correct ? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;Thanks again.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 11:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851125#M16779</guid>
      <dc:creator>Genesis007</dc:creator>
      <dc:date>2022-12-26T11:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851188#M16780</link>
      <description>"a string with MAT, and an undefined number of digits ??)"&lt;BR /&gt;Yes. a string with MAT, and one or more digits followed . &lt;BR /&gt;&lt;BR /&gt;"s is the start point of the search in the string, e is the length of the string.&lt;BR /&gt;call prxnext launch the search of the "pid" in "myfield", from start position defined in s, to the length of "myfield".&lt;BR /&gt;The function return the starting position (p) of my string and its length (l). I think if there's no match found, the prxnext function return a p value &amp;lt; 0 ?"&lt;BR /&gt;Yes. Correct. You can refer to the documentation of PRXNEXT() , there are many examples you can refer .&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Dec 2022 08:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851188#M16780</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-12-27T08:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract informations in serialised data.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851255#M16781</link>
      <description>Once again, thanks for your help !</description>
      <pubDate>Tue, 27 Dec 2022 15:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Extract-informations-in-serialised-data/m-p/851255#M16781</guid>
      <dc:creator>Genesis007</dc:creator>
      <dc:date>2022-12-27T15:57:01Z</dc:date>
    </item>
  </channel>
</rss>

