<?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 Do loop within text variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36755#M9325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jamie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That isn't a macro variable.&amp;nbsp; Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data foo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set bar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 97 to 126;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If originatingIPad = 'xx.xxx.xx.'||strip(i) then keep=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jul 2011 15:04:16 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-07-26T15:04:16Z</dc:date>
    <item>
      <title>Do loop within text variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36754#M9324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wonder if you can help. I'm writing some code to check whether an IP address is within a range of IP addresses.&lt;/P&gt;&lt;P&gt;I have used the following code, however I rekon that the reference to counter "i" is not being resolved and is been taken as a literal i.&lt;/P&gt;&lt;P&gt;the IP address within the table is a string variable not numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data foo;&lt;/P&gt;&lt;P&gt;set bar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 97 to 126;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If originatingIPad = 'xx.xxx.xx.&amp;amp;i.' then keep=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data foobar(drop=keep);&lt;/P&gt;&lt;P&gt;set foo;&lt;/P&gt;&lt;P&gt;where keep=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any assistance offered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 14:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36754#M9324</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2011-07-26T14:53:10Z</dc:date>
    </item>
    <item>
      <title>Do loop within text variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36755#M9325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jamie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That isn't a macro variable.&amp;nbsp; Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data foo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set bar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 97 to 126;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If originatingIPad = 'xx.xxx.xx.'||strip(i) then keep=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 15:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36755#M9325</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-26T15:04:16Z</dc:date>
    </item>
    <item>
      <title>Do loop within text variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36756#M9326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need to test each value?&amp;nbsp; If you convert to numeric you can test using a range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; ip;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; ip:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;$16.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;&amp;nbsp;&amp;nbsp; 000.000.000.123&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;&amp;nbsp;&amp;nbsp; 000.000.000.127&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;where&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;96&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; le input(scan(ip,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'.'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;f3.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;) le &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;126&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 15:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36756#M9326</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-07-26T15:42:11Z</dc:date>
    </item>
    <item>
      <title>Do loop within text variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36757#M9327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks guys &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 15:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36757#M9327</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2011-07-26T15:49:40Z</dc:date>
    </item>
    <item>
      <title>Do loop within text variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36758#M9328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm glad we were able to help but, the more I think about it, aren't you really going to need something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ip;&lt;/P&gt;&lt;P&gt; length originatingIPad $16;&lt;/P&gt;&lt;P&gt; input originatingIPad;&lt;/P&gt;&lt;P&gt; keep=ifn(97&amp;lt;=scan(originatingIPad,-1,'.')&amp;lt;=126,1,.);&lt;/P&gt;&lt;P&gt; cards;&lt;/P&gt;&lt;P&gt;10.0.0.0&lt;/P&gt;&lt;P&gt;10.0.0.1&lt;/P&gt;&lt;P&gt;10.255.255.96&lt;/P&gt;&lt;P&gt;12.12.12.12&lt;/P&gt;&lt;P&gt;172.16.0.97&lt;/P&gt;&lt;P&gt;172.31.255.255&lt;/P&gt;&lt;P&gt;191.191.191.126&lt;/P&gt;&lt;P&gt;192.168.0.0&lt;/P&gt;&lt;P&gt;192.168.255.127&lt;/P&gt;&lt;P&gt;192.168.255.125&lt;/P&gt;&lt;P&gt;255.255.255.254&lt;/P&gt;&lt;P&gt;255.255.255.255&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 16:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-loop-within-text-variable/m-p/36758#M9328</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-26T16:47:45Z</dc:date>
    </item>
  </channel>
</rss>

