<?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 Parsing character string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198197#M49516</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a character field which captures data related to images uploaded to a data system. The system assigns a string to each image, which is essentially a concatenation of a few other fields. The string for each image ends in the following '|FQ|0|F|'. If multiple images are uploaded to a single record, the strings for each image are concatenated into the single character field. There could be up to 10 images concatenated into one string. An example is below containing two images:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$$$.20150309144419.test1.JPG|FND|image 1|FQ|0|F|$$$.20150309144429.test2.JPG|FND|image 2|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to parse this concatenated string so that the string for each individual image is stored in a single field, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Image1 (column 1)&lt;/P&gt;&lt;P&gt;$$$.20150309144419.test1.JPG|FND|image 1|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Image2 (column 2)&lt;/P&gt;&lt;P&gt;$$$.20150309144429.test2.JPG|FND|image 2|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can use a count function to determine the number of instances the '|FQ|0|F|' substring appears, but I am a bit at a loss as to where to go from here. Any thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Mar 2015 13:31:37 GMT</pubDate>
    <dc:creator>lbarwick</dc:creator>
    <dc:date>2015-03-10T13:31:37Z</dc:date>
    <item>
      <title>Parsing character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198197#M49516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a character field which captures data related to images uploaded to a data system. The system assigns a string to each image, which is essentially a concatenation of a few other fields. The string for each image ends in the following '|FQ|0|F|'. If multiple images are uploaded to a single record, the strings for each image are concatenated into the single character field. There could be up to 10 images concatenated into one string. An example is below containing two images:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$$$.20150309144419.test1.JPG|FND|image 1|FQ|0|F|$$$.20150309144429.test2.JPG|FND|image 2|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to parse this concatenated string so that the string for each individual image is stored in a single field, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Image1 (column 1)&lt;/P&gt;&lt;P&gt;$$$.20150309144419.test1.JPG|FND|image 1|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Image2 (column 2)&lt;/P&gt;&lt;P&gt;$$$.20150309144429.test2.JPG|FND|image 2|FQ|0|F|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can use a count function to determine the number of instances the '|FQ|0|F|' substring appears, but I am a bit at a loss as to where to go from here. Any thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 13:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198197#M49516</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2015-03-10T13:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198198#M49517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try something like:&lt;/P&gt;&lt;P&gt;(assuming that the whole input line is stored in all_columns)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=wanted_string);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;x = index(all_columns,'|FQ|0|F|');&lt;/P&gt;&lt;P&gt;do while (x &amp;gt; 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; wanted_string = substr(all_columns,1,x-1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; all_columns = substr(all_columns,x+8);&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;/* process the rest of the line */&lt;/P&gt;&lt;P&gt;wanted_string = all_columns;&lt;/P&gt;&lt;P&gt;if wanted_string &amp;gt; "" then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 13:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198198#M49517</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-10T13:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198199#M49518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; FT15F001 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;temp&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;256&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; image;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; image[&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;10&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;] $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;128&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; FT15F001 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;dlmstr&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'|FQ|0|F|'&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;missover&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; image&lt;LI&gt;;&lt;BR /&gt;&lt;/LI&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; background-color: #ffffff;"&gt;parmcards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;$$&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$.20150309144419&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;.t&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;est1.JPG|FND|image &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;|FQ|&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;|F|$$&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$.20150309144429&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;.t&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;est2.JPG|FND|image &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;|FQ|&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;|F|&lt;BR /&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 13:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198199#M49518</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-03-10T13:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198200#M49519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;text = '$$$.20150309144419.test1.JPG|FND|image 1|FQ|0|F|$$$.20150309144429.test2.JPG|FND|image 2|FQ|0|F|';&lt;/P&gt;&lt;P&gt;id+1;&lt;/P&gt;&lt;P&gt;s=find(text,'|FQ|0|F|','i') ;&lt;/P&gt;&lt;P&gt;x=1;&lt;/P&gt;&lt;P&gt;do while (s &amp;gt; 0);&lt;/P&gt;&lt;P&gt;v=substr(text,x,s+8-x) ;&lt;/P&gt;&lt;P&gt;x=s+8;&lt;/P&gt;&lt;P&gt;s=find(text,'|FQ|0|F|','i',s+8) ;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep id v;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data=temp out=want(drop=_name_) prefix=image_;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;var v;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 16:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing-character-string/m-p/198200#M49519</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-11T16:00:01Z</dc:date>
    </item>
  </channel>
</rss>

