<?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: Help with SAS code which is in a loop in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294583#M60069</link>
    <description>&lt;P&gt;Looks like you want to take the parts inside of the &amp;lt;&amp;gt;. &amp;nbsp;This code will do that and also take values that only have the email address without the name and so do not have any &amp;lt;&amp;gt;s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can scan the original list using ';' as the delimiter and then within each sub-string look for the values between the &amp;lt;&amp;gt; using scan function again, this time using both &amp;lt; and &amp;gt; as the delimiters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set test ;
  length want $32767 ;
  do i=1 to countw(text,';');
     want = catx(';',want,scan(scan(text,i,';'),-1,'&amp;lt;&amp;gt;'));
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 27 Aug 2016 14:51:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2016-08-27T14:51:16Z</dc:date>
    <item>
      <title>Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294495#M60055</link>
      <description>&lt;P&gt;I am trying to read the email_list file and output only email addresses separated by semi-column. &amp;nbsp;But my code goes into a loop.&lt;/P&gt;
&lt;P&gt;Can anybody help me in this??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;email_file.txt has following records:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doe, John &amp;lt;john.doe@abc.com&amp;gt;;Smith, Jeff &amp;lt;jeff.smith@abc.com&amp;gt;; lever, dave &amp;lt;dave.lever@abc.com&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my code:&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;length text $32767;&lt;BR /&gt;&lt;BR /&gt;infile 'c\email_file.txt' lrecl=32767 dsd dlm='09'x truncover;&lt;BR /&gt;&lt;BR /&gt;input text $;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data t1;&lt;BR /&gt;set test;&lt;BR /&gt;length tx3 $500;&lt;BR /&gt;tx3="";&lt;BR /&gt;tx1=text;&lt;BR /&gt;do until (length(cats(tx1))=0);&lt;BR /&gt;space_position = INDEX(tx1, '&amp;lt;');&lt;BR /&gt;slash_position = INDEX(tx1, '&amp;gt;');&lt;BR /&gt;space_to_slash = slash_position - space_position;&lt;BR /&gt;tx2 = substr(tx1, space_position+1, space_to_slash-1);&lt;BR /&gt;tx3=cats(tx3,tx2,";");&lt;BR /&gt;tx4=substr(tx1,find(tx1,";")+1);&lt;BR /&gt;tx1=tx4;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 18:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294495#M60055</guid>
      <dc:creator>pp2014</dc:creator>
      <dc:date>2016-08-26T18:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294503#M60056</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
i=1;
set have;
do until(scan(text,i,';') eq '');
new=scan(text,i,';');
i+1;
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 18:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294503#M60056</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-08-26T18:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294554#M60064</link>
      <description>&lt;PRE.&gt;
filename x temp;
data _null_;
file x;
input;
put _infile_;
cards4;
Doe, John &lt;JOHN.DOE&gt;;Smith, Jeff &lt;JEFF.SMITH&gt;; lever, dave &lt;DAVE.LEVER&gt;
;;;;
run;





data want;
 infile x  dlm='&amp;gt;';
 input @'&amp;lt;' email : $100. @@;
run;

&lt;/DAVE.LEVER&gt;&lt;/JEFF.SMITH&gt;&lt;/JOHN.DOE&gt;&lt;/PRE.&gt;</description>
      <pubDate>Sat, 27 Aug 2016 01:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294554#M60064</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-27T01:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294556#M60065</link>
      <description>&lt;PRE&gt;

filename x temp;
data _null_;
file x;
input;
put _infile_;
cards4;
Doe, John &lt;JOHN.DOE&gt;;Smith, Jeff &lt;JEFF.SMITH&gt;; lever, dave &lt;DAVE.LEVER&gt;
;;;;
run;





data want;
 infile x  dlm='&amp;gt;' lrecl=32767;
 input @'&amp;lt;' email : $100. @@;
run;

&lt;/DAVE.LEVER&gt;&lt;/JEFF.SMITH&gt;&lt;/JOHN.DOE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Aug 2016 01:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294556#M60065</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-27T01:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294570#M60067</link>
      <description>&lt;P&gt;if only the email id has to be retrieved then please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
i=1;
set have;
do until(scan(text,i,';') eq '');
new=compress(scan(scan(text,i,';'),2,'&amp;lt;'),'&amp;gt;');
i+1;
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Aug 2016 03:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294570#M60067</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-08-27T03:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS code which is in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294583#M60069</link>
      <description>&lt;P&gt;Looks like you want to take the parts inside of the &amp;lt;&amp;gt;. &amp;nbsp;This code will do that and also take values that only have the email address without the name and so do not have any &amp;lt;&amp;gt;s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can scan the original list using ';' as the delimiter and then within each sub-string look for the values between the &amp;lt;&amp;gt; using scan function again, this time using both &amp;lt; and &amp;gt; as the delimiters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set test ;
  length want $32767 ;
  do i=1 to countw(text,';');
     want = catx(';',want,scan(scan(text,i,';'),-1,'&amp;lt;&amp;gt;'));
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Aug 2016 14:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-SAS-code-which-is-in-a-loop/m-p/294583#M60069</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-08-27T14:51:16Z</dc:date>
    </item>
  </channel>
</rss>

