<?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: Breaking logic of using if ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723821#M224683</link>
    <description>&lt;P&gt;The log message:&lt;/P&gt;
&lt;PRE&gt;NOTE: Missing values were generated as a result of performing an operation on missing values&lt;/PRE&gt;
&lt;P&gt;and later it points to log line 37 where the code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if cshtrd*prccd_abs_  ....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;means that either CSHTRD or PRCCD_ABS or both contain missing value, therefore the result is missing value.&lt;/P&gt;
&lt;P&gt;You have to decide if you want to deal with this case in a different way and code your program appropriately.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 09:32:30 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2021-03-05T09:32:30Z</dc:date>
    <item>
      <title>Breaking logic of using if ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723810#M224676</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. I get something wrong with my logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the variables&amp;nbsp;&lt;STRONG&gt;cshtrd&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;prccd_abs_&lt;/STRONG&gt; are numeric variables, the summary is as below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1614934161156.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55489i23170D77BCC83F07/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_0-1614934161156.png" alt="My97_0-1614934161156.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I want to generate a variables named &lt;STRONG&gt;dollar_vol= cshtrd*prccd_abs_&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;My code is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Comment trading volume*unadjusted price (converted to USD)&amp;lt; 100$ &lt;BR /&gt;then set missing ;&lt;BR /&gt;&lt;BR /&gt;if cshtrd*prccd_abs_ &amp;lt;100 and n(cshtrd,prccd_abs_)=2 
		then dollar_vol=.;
		else dollar_vol=cshtrd*prccd_abs_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the log says that ( I just post &lt;STRONG&gt;lines 37 and 39&lt;/STRONG&gt; because they are relevant to the NOTE)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;37         		if cshtrd*prccd_abs_ &amp;lt;100 and n(cshtrd,prccd_abs_)=2
38         		then dollar_vol=.;
39         		else dollar_vol=cshtrd*prccd_abs_;

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).
      176040 at 37:12   176040 at 39:25 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am wondering what I did wrong in my calculation and is there any hint to fix it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 09:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723810#M224676</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-05T09:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking logic of using if ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723821#M224683</link>
      <description>&lt;P&gt;The log message:&lt;/P&gt;
&lt;PRE&gt;NOTE: Missing values were generated as a result of performing an operation on missing values&lt;/PRE&gt;
&lt;P&gt;and later it points to log line 37 where the code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if cshtrd*prccd_abs_  ....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;means that either CSHTRD or PRCCD_ABS or both contain missing value, therefore the result is missing value.&lt;/P&gt;
&lt;P&gt;You have to decide if you want to deal with this case in a different way and code your program appropriately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 09:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723821#M224683</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-05T09:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using double if</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723824#M224686</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After changing to double if, the error note no longer exists, and after checking mean, the results from the old and new code are the same for variable &lt;STRONG&gt;dollar_vol&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if n(cshtrd,prccd_abs_)=2 then if cshtrd*prccd_abs_ &amp;lt;100 /*chnaged line*/
		then dollar_vol=.;
		else dollar_vol=cshtrd*prccd_abs_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 09:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-logic-of-using-if/m-p/723824#M224686</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-05T09:40:37Z</dc:date>
    </item>
  </channel>
</rss>

