<?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: Using a where clause to filter out numbers within a dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453858#M29257</link>
    <description>&lt;P&gt;Any string function can do this.&amp;nbsp; All you need to do is ensure it is right aligned, then take char(7) or substr(..7,1).&amp;nbsp; E.g:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if char(reverse(strip(string)),7)="8";
run;&lt;/PRE&gt;
&lt;P&gt;I would question why you have a string of numbers (in a char?) and want to select based on one of them.&amp;nbsp; It sounds like your skipping over a block then extracting something.&amp;nbsp; Maybe consider parsing the string of numbers fully and applying grouping variables to the data to simplify grouping.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 09:12:30 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-13T09:12:30Z</dc:date>
    <item>
      <title>Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453618#M29243</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;been asked a new way of filtering out numbers from a dataset and i'm struggling to find the correct way to do this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the ask is I have a field within a dataset with 10 numbers in that field EXP (1234567890)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we know when the second number is 8 EXP (1823456790) we don't want this in the dataset and wish to remove it &amp;nbsp;anyone got an idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453618#M29243</guid>
      <dc:creator>DaveLarge</dc:creator>
      <dc:date>2018-04-12T15:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453628#M29245</link>
      <description>&lt;P&gt;Per the new post guidance, post test data in the form of a dataset and what you want out at the end (and any code/logs etc.).&amp;nbsp; Do you mean the variable should have the exponential function applied?&amp;nbsp; Its possble that you just want to retain a variable and output based on that, e.g:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  retain lstvar;
  if _n_=1 then lstvar=var;
  else do;
    if lstvar=10 and var=8 then delete;
  end;&lt;BR /&gt;  lst_var=var;
run;&lt;/PRE&gt;
&lt;P&gt;Var is your variable, and 10 and 8 are just to show a value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453628#M29245</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-12T16:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453633#M29246</link>
      <description>&lt;P&gt;This makes a difference in how you solve it.&amp;nbsp; Is EXP:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A character field that holds 10 digits?&lt;/LI&gt;
&lt;LI&gt;A numeric field with values in the billions?&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453633#M29246</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-12T16:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453842#M29253</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;The field only holds 10 digits at most im looking to take out any results where the second digit in is 8 as below – it’s a numeric field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if the 9th number from the right is a 8 I want to delete it from the dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;test data below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;as is&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;number&lt;/TD&gt;&lt;TD&gt;amout&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7814544659&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1289456984&lt;/TD&gt;&lt;TD&gt;15000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;488888&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt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      <pubDate>Fri, 13 Apr 2018 06:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453842#M29253</guid>
      <dc:creator>DaveLarge</dc:creator>
      <dc:date>2018-04-13T06:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453843#M29254</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;The field only holds 10 digits at most im looking to take out any results where the second digit in is 8 as below – it’s a numeric field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if the 9th number from the right is a 8 I want to delete it from the dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;test data below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;as is&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;number&lt;/TD&gt;&lt;TD&gt;amount&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7814544659&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1289456984&lt;/TD&gt;&lt;TD&gt;15000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;488888&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9856456444&lt;/TD&gt;&lt;TD&gt;538&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4548884546&lt;/TD&gt;&lt;TD&gt;5786&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4564564445&lt;/TD&gt;&lt;TD&gt;4226&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;want&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;number&lt;/TD&gt;&lt;TD&gt;amount&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1289456984&lt;/TD&gt;&lt;TD&gt;15000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;488888&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4548884546&lt;/TD&gt;&lt;TD&gt;5786&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4564564445&lt;/TD&gt;&lt;TD&gt;4226&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 06:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453843#M29254</guid>
      <dc:creator>DaveLarge</dc:creator>
      <dc:date>2018-04-13T06:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453851#M29255</link>
      <description>&lt;P&gt;Note how I put the test data in the first step, this is how to provide test data.&lt;/P&gt;
&lt;PRE&gt;data have;
  input number amout count;
datalines;
7814544659	1000	5
1289456984	15000	2
488888	500	7
9856456444	538	7
4548884546	5786	9
4564564445	4226	10
;
run;

data want;
  set have;
  if char(reverse(strip(put(number,best.))),9) ne "8";
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 08:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453851#M29255</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-13T08:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453854#M29256</link>
      <description>&lt;P&gt;this is perfect thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have to do the same with 8 digits that are already format as Char so exactly the same I want to take out the all the results where the 7th number from right is 8 ? can you help there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help on this its really helped out&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 08:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453854#M29256</guid>
      <dc:creator>DaveLarge</dc:creator>
      <dc:date>2018-04-13T08:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using a where clause to filter out numbers within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453858#M29257</link>
      <description>&lt;P&gt;Any string function can do this.&amp;nbsp; All you need to do is ensure it is right aligned, then take char(7) or substr(..7,1).&amp;nbsp; E.g:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if char(reverse(strip(string)),7)="8";
run;&lt;/PRE&gt;
&lt;P&gt;I would question why you have a string of numbers (in a char?) and want to select based on one of them.&amp;nbsp; It sounds like your skipping over a block then extracting something.&amp;nbsp; Maybe consider parsing the string of numbers fully and applying grouping variables to the data to simplify grouping.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 09:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-a-where-clause-to-filter-out-numbers-within-a-dataset/m-p/453858#M29257</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-13T09:12:30Z</dc:date>
    </item>
  </channel>
</rss>

