<?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: remove value that contain 21 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361120#M85123</link>
    <description>&lt;P&gt;Well 90-99 all consist of 9x, so you can just do:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have (where=(substr(naics,1,2) ne '21' and char(naics,1) ne '9'));
run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 May 2017 09:40:48 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-05-24T09:40:48Z</dc:date>
    <item>
      <title>remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361074#M85106</link>
      <description>&lt;P&gt;I have a dataset which has more than 10 million observations. &amp;nbsp;In this, I have variable name NAICS it has different values. I want to remove all those values that start with 21.&amp;nbsp;It contains different no of digits like 21, 2145, 210454 etc. So My intention is to remove all values with start with 21. &amp;nbsp;There are some values of NAICS variable which end with 21 but I don't want them to be affected. Thanking in anticipation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 08:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361074#M85106</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2017-05-24T08:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361078#M85109</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if NAICS =:'21' then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that variable is a character variable&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 08:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361078#M85109</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-05-24T08:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361079#M85110</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18537"&gt;@Jahanzaib&lt;/a&gt;: Is your variable numeric or character? And what do you mean by "removing" a value? Do you mean setting the variable to missing, or do you mean deleting the whole observation? In your example, all the values that you want to get rid of&amp;nbsp;&lt;STRONG&gt;start&lt;/STRONG&gt; with the number 21, does that mean that you do not want to get rid of values like 18212 or 321?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 08:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361079#M85110</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-24T08:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361080#M85111</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input NAICS;
datalines;
21234
2134664
42355
235353
214356
;

data want;
	set have;
	if substr(left(NAICS),1,2) NE '21';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 08:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361080#M85111</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-24T08:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361082#M85112</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt; I mean deleting whole observation. It's a character variable. Right. I don't want to delete values like 18212 or 321. delete only those which start with 21 not the others.</description>
      <pubDate>Wed, 24 May 2017 08:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361082#M85112</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2017-05-24T08:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361083#M85113</link>
      <description>&lt;P&gt;I assumed a numeric variable, but my solution will work for a character variable as well.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 08:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361083#M85113</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-24T08:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361084#M85114</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18537"&gt;@Jahanzaib&lt;/a&gt;: Then the fastest and simplest is probably using a WHERE clause:&lt;/P&gt;&lt;PRE&gt;data want;
  set have;
  where NAICS not like '21%';
run;&lt;/PRE&gt;&lt;P&gt;- this assuming that the values are left aligned, otherwise use&lt;/P&gt;&lt;PRE&gt;where left(NAICS) not like '21%';&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 08:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361084#M85114</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-24T08:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361088#M85116</link>
      <description>&lt;P&gt;I would really advise you to try both methods on the 10mill records as I suspect this (from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have (where=(substr(naics,1,2) ne '21'));
run;
&lt;/PRE&gt;
&lt;P&gt;Would be faster than the given solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if substr(left(naics),1,2) ne '21';
run;&lt;/PRE&gt;
&lt;P&gt;I can't prove this offhand, but vaguely remember something aboutthe set reading in the data for each row and then outputting on the if, where the where clause restricts what is coming in, so slightly earlier in the process. &amp;nbsp;If so then this fractional saving would add up of millions of records. &amp;nbsp;But do test.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 08:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361088#M85116</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-24T08:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361099#M85117</link>
      <description>Thankyou &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; How to delete if first two digits are 90 or greater than 90?</description>
      <pubDate>Wed, 24 May 2017 09:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361099#M85117</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2017-05-24T09:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361111#M85120</link>
      <description>&lt;P&gt;From your responses, i assume you are not familiar with wild card operators or colon modifiers. If you have a grasping you would have chosen &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&amp;nbsp;'s answer without having to deal with functions that makes&amp;nbsp;SAS&amp;nbsp;work more.&lt;/P&gt;&lt;P&gt;If you understand collating sequences , the below solution is easy&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var&amp;gt;=:&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'90'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; delete;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Naveen Srinivasan&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 09:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361111#M85120</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-05-24T09:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361116#M85121</link>
      <description>&lt;P&gt;Also, the same &amp;nbsp;can be applied to a where clause:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; not (var&amp;gt;=:&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'90'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 09:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361116#M85121</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-05-24T09:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: remove value that contain 21</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361120#M85123</link>
      <description>&lt;P&gt;Well 90-99 all consist of 9x, so you can just do:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have (where=(substr(naics,1,2) ne '21' and char(naics,1) ne '9'));
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 09:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-value-that-contain-21/m-p/361120#M85123</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-24T09:40:48Z</dc:date>
    </item>
  </channel>
</rss>

