<?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: URL fetching from paragraph in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627433#M185228</link>
    <description>&lt;P&gt;Count through "words" separated by blanks, identify those beginning with the wanted token, and concatenate to a new string:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards ;
input url &amp;amp; $5000.;
cards;
https://www.youtube.com/w ahsjskjk https://www.yahoo.com jhjkj https://www.google.com
;

data want;
set have (rename=(url=_url));
length url $5000;
do _i = 1 to countw(_url," ");
  _word = scan(_url,_i," ");
  if substr(_word,1,4) = "http" then url = catx(" ",url,_word);
end;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Feb 2020 08:14:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-02-26T08:14:03Z</dc:date>
    <item>
      <title>URL fetching from paragraph</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627415#M185213</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my variable there are multiple URL were entered , but not in sequence. I need to filter all the URL in new dataset. Below is the sample data .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards ;
input url &amp;amp; $5000.;
cards;
https://www.youtube.com/w ahsjskjk https://www.yahoo.com jhjkj https://www.google.com
;
run;


Output want:

URL
https://www.youtube.com/w  https://www.yahoo.com  https://www.google.com&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 06:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627415#M185213</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2020-02-26T06:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: URL fetching from paragraph</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627433#M185228</link>
      <description>&lt;P&gt;Count through "words" separated by blanks, identify those beginning with the wanted token, and concatenate to a new string:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards ;
input url &amp;amp; $5000.;
cards;
https://www.youtube.com/w ahsjskjk https://www.yahoo.com jhjkj https://www.google.com
;

data want;
set have (rename=(url=_url));
length url $5000;
do _i = 1 to countw(_url," ");
  _word = scan(_url,_i," ");
  if substr(_word,1,4) = "http" then url = catx(" ",url,_word);
end;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Feb 2020 08:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627433#M185228</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-26T08:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: URL fetching from paragraph</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627438#M185233</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153275"&gt;@singhsahab&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is another approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	select max(countw(url,' ')), max(count(url,"http")) into:nb1,:nb2 from have;
quit;

data want;
	set have;
	array _URL (&amp;amp;nb1) $ 200;
	array URL_ (&amp;amp;nb2) $ 200;
	do i=1 to countw(url,' ');
		if prxmatch('/http/',scan(url,i,' ')) then _URL(i) = scan(url,i,' ');
	end;
	URL_extract = catx(',',of _URL(*));
	do j=1 to count(url,"http");
		URL_(j) = scan(URL_extract,j,',');
	end;
	drop i j URL_extract _:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-02-26 à 09.47.05.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36399iC1C72626A70BD4AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2020-02-26 à 09.47.05.png" alt="Capture d’écran 2020-02-26 à 09.47.05.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 08:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URL-fetching-from-paragraph/m-p/627438#M185233</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-26T08:47:33Z</dc:date>
    </item>
  </channel>
</rss>

