<?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: removing bad values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396649#M95797</link>
    <description>&lt;PRE&gt;
Post some data and output would be better to explain your question.

data have;
  infile datalines truncover;
  input account_no $40.;
  datalines;
123045600
123945699
000000000000000
0000
00000000000000000000000
99999999999999 
99999999 
99999999999999999
0999090
;
run;
data want;
 set have;
 if prxmatch('/^(0+|9{2,})/',account_no) then delete;
 run;


&lt;/PRE&gt;</description>
    <pubDate>Sun, 17 Sep 2017 13:13:00 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-09-17T13:13:00Z</dc:date>
    <item>
      <title>removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396481#M95727</link>
      <description>&lt;P&gt;Hi, I am creating a file and have found that one of my fields has a lot of garbage in it and I need to exclude those records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is an account_no field and I am trying to exclude values that have 1 zero or multiple zeros or multiple 9's. &amp;nbsp;I have tried using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table x as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select * from y where account_no not like '0000000000%' or account_no not like '9999999999%';&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but that is not doing anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data step that I am using a delete&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If account_no in (' ','0','*') then delete;&lt;/P&gt;
&lt;P&gt;that works for those values but not for the one's that have the multiple zeros or 9's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Elliott&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396481#M95727</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-09-15T20:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396486#M95732</link>
      <description>&lt;P&gt;At a minimum, you should start with your SQL code, but replace OR with AND.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any possible value is not equal to "A" or not equal to "B".&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396486#M95732</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-15T20:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396487#M95733</link>
      <description>&lt;P&gt;You should more clearly define exactly what you mean by "multiple 0's" or 'multiple 9's"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can really see these as being valid if fake account numbers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;123045600&lt;/P&gt;
&lt;P&gt;123945699&lt;/P&gt;
&lt;P&gt;both have multiple 0 or 9. Would those be excluded?&lt;/P&gt;
&lt;P&gt;Or do you mean ALL 0 or ALL 9? Or something else?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396487#M95733</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-15T20:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396513#M95746</link>
      <description>&lt;P&gt;multiple zero's &amp;nbsp;= 000000000000000 or 0000 or 00000000000000000000000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;multiple 9's = 99999999999999# or 99999999 or 99999999999999999&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 23:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396513#M95746</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-09-15T23:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396520#M95749</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17300"&gt;@Elliott&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Providing sample data via a SAS data step helps all of us to avoid missunderstandings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If below uses representative sample data then the code should do the job for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input account_no $40.;
  datalines;
123045600
123945699
000000000000000
0000
00000000000000000000000
99999999999999 
99999999 
99999999999999999
0999090
;
run;

proc sql; 
  select * 
  from have 
  where not missing(compress(account_no,'9')) and not missing(compress(account_no,'0')) 
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Sep 2017 00:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396520#M95749</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-16T00:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396562#M95760</link>
      <description>this cares for everything except for the values that have 99999999999999#, what do I do about that type of data.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Sep 2017 11:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396562#M95760</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-09-16T11:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396588#M95771</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17300"&gt;@Elliott&lt;/a&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17300"&gt;@Elliott&lt;/a&gt; wrote:&lt;BR /&gt;this cares for everything except for the values that have 99999999999999#, what do I do about that type of data.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What can you think of?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 21:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396588#M95771</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-16T21:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: removing bad values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396649#M95797</link>
      <description>&lt;PRE&gt;
Post some data and output would be better to explain your question.

data have;
  infile datalines truncover;
  input account_no $40.;
  datalines;
123045600
123945699
000000000000000
0000
00000000000000000000000
99999999999999 
99999999 
99999999999999999
0999090
;
run;
data want;
 set have;
 if prxmatch('/^(0+|9{2,})/',account_no) then delete;
 run;


&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Sep 2017 13:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-bad-values/m-p/396649#M95797</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-09-17T13:13:00Z</dc:date>
    </item>
  </channel>
</rss>

