<?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: Why there is not = 1 after first.variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840065#M332163</link>
    <description>&lt;P&gt;Boolean variables created by SAS (like the FIRST. and LAST., but also those defined with IN= or END= options) can only take on values of 0 and 1, which means false and true, respectively, and can be used as a Boolean value on their own.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Oct 2022 10:03:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-10-22T10:03:06Z</dc:date>
    <item>
      <title>Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840059#M332158</link>
      <description>&lt;P&gt;In the SAS Programming 2 course, the solution is&lt;/P&gt;
&lt;PRE&gt;if first.Product then TotalProfit=0;&lt;/PRE&gt;
&lt;P&gt;but in the instruction, where was all done with first.variable = 1 or last.variable = 1. Why was it omitted in this cause? Is it because =1 means True and "if first.product " statement means if True as well?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nietzche_0-1666428755997.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76461iB34674B4DFA47A8A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nietzche_0-1666428755997.png" alt="Nietzche_0-1666428755997.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also why is&amp;nbsp; the last.product have a =1 after it?&lt;/P&gt;
&lt;P&gt;Is it because if you have a if/then statement you don't need the =1, but you use only the IF statement, you will need to put the =1?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nietzche_0-1666429652434.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76462i29DBA1B55E87B746/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nietzche_0-1666429652434.png" alt="Nietzche_0-1666429652434.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 09:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840059#M332158</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-22T09:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840061#M332159</link>
      <description>&lt;P&gt;The =1 is not needed because SAS automaticaly evaluates 1 as "true" and 0 as "false".&amp;nbsp; Actually, SAS evaluates any numeric value.&amp;nbsp; 0 and missing values are considered to be false.&amp;nbsp; Any other value (including negative numbers) is considered to be true.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 09:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840061#M332159</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-10-22T09:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840065#M332163</link>
      <description>&lt;P&gt;Boolean variables created by SAS (like the FIRST. and LAST., but also those defined with IN= or END= options) can only take on values of 0 and 1, which means false and true, respectively, and can be used as a Boolean value on their own.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 10:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840065#M332163</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-22T10:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840076#M332165</link>
      <description>&lt;P&gt;The two expressions are equivalent.&amp;nbsp; The first more clearly shows the INTENT of the programmer.&amp;nbsp; The intent is to test if the flag is TRUE or FALSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS only has two type of variables.&amp;nbsp; Fixed length character strings and floating point numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will treat a numeric value of 0 or missing as FALSE and any other value as TRUE when performing a boolean test, such as in your first example code.&amp;nbsp; SAS will generate 0 for true and 1 for FALSE as the result of any boolean operator.&amp;nbsp; So boolean flags created by SAS such as FIRST. and LAST.&amp;nbsp;will be either 0 or 1.&amp;nbsp; You can treat them as boolean values (if first.product) or treat them as numbers (if last.product=1).&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 12:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840076#M332165</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-22T12:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840111#M332190</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will treat a numeric value of 0 or missing as FALSE and any other value as TRUE when performing a boolean test, such as in your first example code.&amp;nbsp;&lt;STRONG&gt; SAS will generate 0 for true and 1 for FALSE as the result of any boolean operator.&lt;/STRONG&gt;&amp;nbsp; So boolean flags created by SAS such as FIRST. and LAST.&amp;nbsp;will be either 0 or 1.&amp;nbsp; You can treat them as boolean values (if first.product) or treat them as numbers (if last.product=1).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;is this a typo? 0 for TRUE 1 for FALSE?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 20:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840111#M332190</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-22T20:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why there is not = 1 after first.variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840118#M332195</link>
      <description>&lt;P&gt;It's a typo.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 20:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-there-is-not-1-after-first-variable/m-p/840118#M332195</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-22T20:30:16Z</dc:date>
    </item>
  </channel>
</rss>

