<?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: Treating a missing value as zero for a calculated field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83871#M256832</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I meant the missing input to zero &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; I do agree with the rant, though. Still some people think that NULL = 0 &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Apr 2013 11:15:38 GMT</pubDate>
    <dc:creator>pmdci</dc:creator>
    <dc:date>2013-04-23T11:15:38Z</dc:date>
    <item>
      <title>Treating a missing value as zero for a calculated field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83868#M256829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset with two variables: funding Year1 and funding Year2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a third variable, which would hold the calculated different between Year1 and Year2:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Diff_Y1Y2 = Year1 - Year2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I noticed that if either Year1 or Year2 has a missing value, the value of the calculated Diff_Y1Y2 will also be missing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;198267 - NULL = NULL;&lt;/P&gt;&lt;P&gt;NULL - 198267 = NULL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping that for the sake of the calculation, the value could be treated as zero. Is that possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 20:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83868#M256829</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2013-01-23T20:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Treating a missing value as zero for a calculated field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83869#M256830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input v1 v2;&lt;BR /&gt;cards;&lt;BR /&gt;2 .&lt;BR /&gt;7 5&lt;BR /&gt;. 6&lt;BR /&gt;. .&lt;BR /&gt;;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;diff=sum(v1,-v2,0);&lt;BR /&gt;proc print;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; v1&amp;nbsp;&amp;nbsp;&amp;nbsp; v2&amp;nbsp;&amp;nbsp;&amp;nbsp; diff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -6&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 20:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83869#M256830</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-01-23T20:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Treating a missing value as zero for a calculated field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83870#M256831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While it is certainly possible to program that to occur, the bigger question is "Why?"&amp;nbsp; Why set an indeterminant value to zero?&amp;nbsp; If you have a good business rule for doing so, then go for it (code below).&amp;nbsp; But if it is a matter that perhaps the data was not observed/collected for a given year, you shouldn't set the value to zero, because you shouldn't assume that the funding was identical in both years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (.&amp;lt;year1 and .&amp;lt;year2) then diff_y1y2=year1 - year2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else diff_y1y2=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Added upon rereading the OP:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I may have misunderstood you.&amp;nbsp; If you meant to set the missing INPUT value to zero, then pay no attention to my ranting.&amp;nbsp; My concern was that you wanted to set the OUTPUT (the difference) to zero if one of the inputs was missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 20:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83870#M256831</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2013-01-23T20:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Treating a missing value as zero for a calculated field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83871#M256832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I meant the missing input to zero &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; I do agree with the rant, though. Still some people think that NULL = 0 &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 11:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Treating-a-missing-value-as-zero-for-a-calculated-field/m-p/83871#M256832</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2013-04-23T11:15:38Z</dc:date>
    </item>
  </channel>
</rss>

