<?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: Variable filtering in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420475#M103487</link>
    <description>&lt;P&gt;Functions can handle all the data inspection.&amp;nbsp; Some examples:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if substr(var, 4, 1) ne '_' then ....;&lt;/P&gt;
&lt;P&gt;if index(var, '.') &amp;gt;&amp;nbsp;0 then ....;&lt;/P&gt;
&lt;P&gt;if input(substr(var, 4, 5), ??5.) = . then .....;&lt;/P&gt;
&lt;P&gt;if substr(var, length(var)-3) ne q then ....;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Putting the observation into a new variable is open to debate, however.&amp;nbsp; It's not really clear what that means.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2017 14:31:38 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-12-12T14:31:38Z</dc:date>
    <item>
      <title>Variable filtering</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420470#M103483</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The high level view of my program is that i have to query a database and i need to determine if observations in a particular variable are formatted correctly.&amp;nbsp; Here is my filtering criteria:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if position 4 is not "_"&lt;/P&gt;&lt;P&gt;if any position includes "."&lt;/P&gt;&lt;P&gt;if position 4-8 not numeric&lt;/P&gt;&lt;P&gt;if last 4 chars not match variable q&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then put this observation in a new variable called Q&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to me that these are all possible, but part of my problem is that i don't know how to look up in the documentation on how to go about this.&amp;nbsp; I'm not necessarily looking for someone to give me the answer here, but offer how I can go about finding out how to do this on my own...perhaps give me one example and let me go off on my own.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help here is greatly appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 14:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420470#M103483</guid>
      <dc:creator>prolifious</dc:creator>
      <dc:date>2017-12-12T14:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Variable filtering</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420474#M103486</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;if position 4 is not "_"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;= if char(thedata,4)="_" then ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if any position includes "."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;= if index(thedata,".") &amp;gt; 0 then ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if position 4-8 not numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;= if lengthn(compress(substr(thedata,4,4)," ","d")) &amp;gt; 0 then ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if last 4 chars not match variable q&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;= if substr(thedata,lengthn(thedata)-4,4) ne "qqqq" then ...&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 14:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420474#M103486</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-12T14:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Variable filtering</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420475#M103487</link>
      <description>&lt;P&gt;Functions can handle all the data inspection.&amp;nbsp; Some examples:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if substr(var, 4, 1) ne '_' then ....;&lt;/P&gt;
&lt;P&gt;if index(var, '.') &amp;gt;&amp;nbsp;0 then ....;&lt;/P&gt;
&lt;P&gt;if input(substr(var, 4, 5), ??5.) = . then .....;&lt;/P&gt;
&lt;P&gt;if substr(var, length(var)-3) ne q then ....;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Putting the observation into a new variable is open to debate, however.&amp;nbsp; It's not really clear what that means.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 14:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420475#M103487</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-12T14:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Variable filtering</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420506#M103498</link>
      <description>&lt;P&gt;See the character functions in this table:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some that you may want to look for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUBSTR()&lt;/P&gt;
&lt;P&gt;FIND()/INDEX()&lt;/P&gt;
&lt;P&gt;ANYALPHA()&lt;/P&gt;
&lt;P&gt;ANYNUM()&lt;/P&gt;
&lt;P&gt;LENGTH()&lt;/P&gt;
&lt;P&gt;REVERSE()&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 15:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-filtering/m-p/420506#M103498</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-12T15:51:36Z</dc:date>
    </item>
  </channel>
</rss>

