<?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 How do I write not equal to a negative number? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841045#M332543</link>
    <description>&lt;P&gt;How do I write not equal to a negative number? I want to include zeros, positive numbers, and null values. Basically I want to only exclude anything that has "-" in front of a number.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 23:49:06 GMT</pubDate>
    <dc:creator>InspectahDex</dc:creator>
    <dc:date>2022-10-26T23:49:06Z</dc:date>
    <item>
      <title>How do I write not equal to a negative number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841045#M332543</link>
      <description>&lt;P&gt;How do I write not equal to a negative number? I want to include zeros, positive numbers, and null values. Basically I want to only exclude anything that has "-" in front of a number.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 23:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841045#M332543</guid>
      <dc:creator>InspectahDex</dc:creator>
      <dc:date>2022-10-26T23:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write not equal to a negative number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841046#M332544</link>
      <description>&lt;P&gt;There is no such thing as null values in SAS. I assume you mean missing values. This should do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where MyNumber = . or MyNumber &amp;gt;= 0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 00:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841046#M332544</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-10-27T00:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write not equal to a negative number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841054#M332546</link>
      <description>&lt;P&gt;Since you want to include the missing values you will need to test for missing values separately.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where x&amp;gt;=0 or missing(x) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you wanted to exclude positive values (keeping missing and negative values) it would be easier because missing values are smaller than all actual numbers so you could just use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where x &amp;lt;=0 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you could use negate the value and use that test:&lt;/P&gt;
&lt;PRE&gt;2125  data _null_;
2126    do x=.,.z,-1,0,1 ;
2127      test1 = (x &amp;gt;= 0) or missing(x);
2128      test2 = -x &amp;lt;= 0 ;
2129      put x= test1= test2= ;
2130    end;
2131  run;

x=. test1=1 test2=1
x=Z test1=1 test2=1
x=-1 test1=0 test2=0
x=0 test1=1 test2=1
x=1 test1=1 test2=1
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2 at 2128:14
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;But notice that it causes notes to be generated when there are missing values since it is performing the negation operation on the value.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 02:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841054#M332546</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-27T02:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write not equal to a negative number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841071#M332555</link>
      <description>&lt;P&gt;Provide some examples of values an results of how you are using this.&lt;/P&gt;
&lt;P&gt;There are often several ways to accomplish things in SAS and know what you want and how that result is used might point us to a more flexible method than one that "works" for a very small use case.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 06:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841071#M332555</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-27T06:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write not equal to a negative number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841121#M332570</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Or try SIGN() function*/
data have;
input x;
if sign(x)=-1 then delete;
cards;
98
0
.
-98
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 12:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-not-equal-to-a-negative-number/m-p/841121#M332570</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-27T12:04:20Z</dc:date>
    </item>
  </channel>
</rss>

