<?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 to find the nth string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701909#M214959</link>
    <description>gosh, i think i was thinking too technical, thanks!</description>
    <pubDate>Thu, 26 Nov 2020 21:06:54 GMT</pubDate>
    <dc:creator>HitmonTran</dc:creator>
    <dc:date>2020-11-26T21:06:54Z</dc:date>
    <item>
      <title>how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701893#M214955</link>
      <description>&lt;P&gt;I need to extract the time range and location from a variable "Itemproperties".&amp;nbsp; I'm having difficulty bc some location have 2 delimerters ("@") and others will have 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_0-1606422767859.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52027iA6202A1BFB390E14/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HitmonTran_0-1606422767859.png" alt="HitmonTran_0-1606422767859.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Itemproperties&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pickup Details:6. 11/21 SAT 4:40 - 5:00 @ Mountain View @ Ranch 99&lt;/P&gt;&lt;P&gt;Pickup Details:6. 11/21 SAT 5:30 - 5:50 @ Cupertino&lt;/P&gt;&lt;P&gt;Pickup Details:5. 10/23 FRI 4:40 - 5:00 @ W. SJ @ Starbucks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;time&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Mountain View&amp;nbsp;@ Ranch 99&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4:40 - 5:00&lt;/P&gt;&lt;P&gt;Cupertino&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5:30 - 5:50&lt;/P&gt;&lt;P&gt;W. SJ @ Starbucks&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;4:40 - 5:00&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 20:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701893#M214955</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-11-26T20:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701894#M214956</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111564"&gt;@HitmonTran&lt;/a&gt;&amp;nbsp; Can you please paste the data as plain text rather than pics for users to copy paste?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 20:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701894#M214956</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-26T20:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701895#M214957</link>
      <description>updated, thanks for looking into this</description>
      <pubDate>Thu, 26 Nov 2020 20:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701895#M214957</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-11-26T20:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701898#M214958</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111564"&gt;@HitmonTran&lt;/a&gt;&amp;nbsp; Have i read the pattern correctly here? If yes, it's too simple &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input Itemproperties $100.;
cards;
Pickup Details:6. 11/21 SAT 4:40 - 5:00 @ Mountain View @ Ranch 99
Pickup Details:6. 11/21 SAT 5:30 - 5:50 @ Cupertino
Pickup Details:5. 10/23 FRI 4:40 - 5:00 @ W. SJ @ Starbucks
;

data want;
 set have;
 location=substr(Itemproperties,42);
 time=substr(Itemproperties,29,12);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Nov 2020 20:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701898#M214958</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-26T20:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701909#M214959</link>
      <description>gosh, i think i was thinking too technical, thanks!</description>
      <pubDate>Thu, 26 Nov 2020 21:06:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701909#M214959</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-11-26T21:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701912#M214960</link>
      <description>&lt;P&gt;Actually so did I. I was thinking perhaps to construct a regular expression of sorts. However, either way I would still need to identify a pattern. That's when I noticed the heck in the pattern. Haha. Have a great thanksgiving holiday. Happy thanksgiving!!!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 21:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701912#M214960</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-26T21:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701918#M214962</link>
      <description>ok sorry, the substr function doesn't work. The position is not consistent throughout all records. It only worked in the example above</description>
      <pubDate>Thu, 26 Nov 2020 21:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701918#M214962</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-11-26T21:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701924#M214965</link>
      <description>&lt;P&gt;Can you post a few more records that varies plz?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi again&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111564"&gt;@HitmonTran&lt;/a&gt;&amp;nbsp; I took your updated sample from the other thread. I used COMPBL function for the updated sample-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input Itemproperties $100.;
cards;
Pickup Details:6. 11/21 SAT    4:40 - 5:00 @ Mountain View @ Ranch 99
Pickup Details:6. 11/21 SAT 5:30 - 5:50 @ Cupertino
Pickup Details:5.      10/23 FRI 4:40 - 5:00 @     W. SJ @   Starbucks
;
data want;
 set have;
 location=substr(compbl(Itemproperties),42);
 time=substr(compbl(Itemproperties),29,12);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 21:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701924#M214965</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-26T21:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701928#M214967</link>
      <description>still not working, for example 12:00 will have an extra position compared to 2:00, thanks for looking into this during the holiday</description>
      <pubDate>Thu, 26 Nov 2020 22:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701928#M214967</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-11-26T22:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701933#M214969</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input Itemproperties $100.;
cards;
Pickup Details:6. 11/21 SAT    4:40 - 5:00 @ Mountain View @ Ranch 99
Pickup Details:6. 11/21 SAT 5:30 - 5:50 @ Cupertino
Pickup Details:5.      10/23 FRI 4:40 - 5:00 @     W. SJ @   Starbucks
;

data want;
 set have;
 time=prxchange('s/.*?(\d?\d:\d{2}\s-\s\d?\d:\d{2}\s(?=@)).*/$1/', -1, Itemproperties);
 location=compbl(substr(Itemproperties,index(Itemproperties,'@')+1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Nov 2020 22:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/701933#M214969</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-26T22:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the nth string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/702014#M215000</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input Itemproperties $100.;
cards;
Pickup Details:6. 11/21 SAT    4:40 - 5:00 @ Mountain View @ Ranch 99
Pickup Details:6. 11/21 SAT 5:30 - 5:50 @ Cupertino
Pickup Details:5.      10/23 FRI 4:40 - 5:00 @     W. SJ @   Starbucks
;

data want;
 set have;
 call scan(Itemproperties,2,p,l,'@');
 location=substr(Itemproperties,p);
 time=scan(substr(Itemproperties,1,p-1),-1,'@','a');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 13:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-nth-string/m-p/702014#M215000</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-11-27T13:25:01Z</dc:date>
    </item>
  </channel>
</rss>

