<?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: Sum with missing value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370538#M88499</link>
    <description>&lt;P&gt;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;OK&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab14_16unionRep;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; code KNIV groupe _2016total _2015total _2014total;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01022701 5 227 9 8 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01033401 5 227 . 7 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32022710 3 227 21 31 11&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024002 3 240 12 . .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024005 3 240 . 14 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" 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;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab14_16unionSort;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; code&amp;nbsp; _2016total _2015total _2014total;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01022701 11.12 13.25 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01033401&amp;nbsp; . 10.23 15.21&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32022710&amp;nbsp; 21.24 31.68 11.47&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024002&amp;nbsp; 13.36 . .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024005&amp;nbsp; . 15.11 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" 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;The result I need :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 36&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 26&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;What my 2 programs done :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;proc sql;&lt;BR /&gt;create table Tab14_16GrpNiv2 as select&amp;nbsp; KNIV, groupe,&lt;BR /&gt;/* sum(tab14_16unionRep._2016total, tab14_16unionRep._2015total, tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&amp;nbsp; */&lt;BR /&gt;sum(tab14_16unionRep._2016total) + sum(tab14_16unionRep._2015total) + sum(tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&lt;BR /&gt;from tab14_16unionSort&amp;nbsp; inner join tab14_16unionRep on tab14_16unionSort.diplome_pre = tab14_16unionRep.diplome_pre&lt;BR /&gt;Group by KNIV, groupe;&lt;BR /&gt;quit;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 19&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 14&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;or&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 36&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 .&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;PS : &lt;SPAN class=""&gt;Providing a data set allowed me understand &lt;STRONG&gt;better &lt;/STRONG&gt;(I'm a beginner in SAS, but no in MS Access SQL)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2017 13:48:24 GMT</pubDate>
    <dc:creator>eric232</dc:creator>
    <dc:date>2017-06-26T13:48:24Z</dc:date>
    <item>
      <title>Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370460#M88461</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table Tab14_16GrpNiv as select&amp;nbsp; KNIV, "" as typdip, groupe,&lt;BR /&gt;sum(tab14_16unionRep._2016total) as NbRep16,&lt;BR /&gt;sum(tab14_16unionRep._2015total) as NbRep15,&lt;BR /&gt;sum(tab14_16unionRep._2014total) as NbRep14,&lt;BR /&gt;sum(tab14_16unionRep._2016total) + sum(tab14_16unionRep._2015total) + sum(tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16 &amp;nbsp;&lt;BR /&gt;from tab14_16unionSort&amp;nbsp; inner join tab14_16unionRep on tab14_16unionSort.code = tab14_16unionRep.code&lt;BR /&gt;Group by&amp;nbsp; KNIV, "", groupe;&lt;BR /&gt;quit;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example :&amp;nbsp; NbRep16 = . , NbRep15 = .&amp;nbsp; and NbRep14 = 45&amp;nbsp;&amp;nbsp; ---&amp;gt; The result is NbRep14_16&amp;nbsp; = .&lt;/P&gt;&lt;P&gt;But I woud like have NbRep14_16&amp;nbsp; = 45 and not "."&lt;/P&gt;&lt;P&gt;How to do ? Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 09:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370460#M88461</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T09:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370461#M88462</link>
      <description>&lt;P&gt;So you want missing values to be treated as zeros in your summation?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 09:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370461#M88462</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-26T09:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370462#M88463</link>
      <description>&lt;P&gt;Use sum() function:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table Tab14_16GrpNiv as 
  select  kniv, &lt;BR /&gt;          "" as typdip, 
          groupe,
          sum(tab14_16unionRep._2016total) as NbRep16,
          sum(tab14_16unionRep._2015total) as NbRep15,
          sum(tab14_16unionRep._2014total) as NbRep14,
          sum(calculated nbrep16,calculated nbrep15,calculated nbrep14)  as NbRep14_16  
  from    tab14_16unionSort  
  inner join tab14_16unionRep 
  on      tab14_16unionSort.code = tab14_16unionRep.code
  group by kniv,&lt;BR /&gt;           groupe;
quit;   &lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370462#M88463</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T10:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370463#M88464</link>
      <description>&lt;P&gt;Yes, treated as zeros in the summation, but not replaced by 0 in the columns&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370463#M88464</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T10:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370464#M88465</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Esteemed-Advisor"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151" target="_self"&gt;&lt;SPAN class="login-bold"&gt;RW9&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I don't understans ! I used sum() function... What is the diference between my program and your answer ?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370464#M88465</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T10:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370465#M88466</link>
      <description>&lt;P&gt;You used the + operator on nbrep14_16:&lt;/P&gt;
&lt;P&gt;. + . + 45 = .&lt;/P&gt;
&lt;P&gt;The sum() function however sums all present values:&lt;/P&gt;
&lt;P&gt;sum(.,.,45) = 45&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Per the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245953.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245953.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370465#M88466</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T10:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370466#M88467</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;I tried this, but grouping does not happen, I get the same number of lines, KNIV*groupe are repeated&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;proc sql;&lt;BR /&gt;create table Tab14_16GrpNiv1 as select&amp;nbsp; KNIV, "" as typdip, groupe,&lt;BR /&gt;sum(tab14_16unionRep._2016total) as NbRep16,&lt;BR /&gt;sum(tab14_16unionRep._2015total) as NbRep15,&lt;BR /&gt;sum(tab14_16unionRep._2014total) as NbRep14,&lt;BR /&gt;sum(tab14_16unionRep._2016total, tab14_16unionRep._2015total, tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16 &amp;nbsp;&lt;BR /&gt;from tab14_16unionSort&amp;nbsp; inner join tab14_16unionRep on tab14_16unionSort.code = tab14_16unionRep.code&lt;BR /&gt;Group by KNIV, "", groupe;&lt;BR /&gt;quit;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370466#M88467</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T10:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370469#M88468</link>
      <description>&lt;P&gt;Pleas re-read my code, particularly the keyword calculated.&lt;/P&gt;
&lt;P&gt;Also, its a good idea to follow the guidance you will find next to the Post button on new questions. &amp;nbsp;Provide example test data in the form of a datastep so that we can a) see the structure, and b) have something to run against. &amp;nbsp;Also posting example required output is a good idea.&lt;/P&gt;
&lt;P&gt;There is also a code window - {i} above the post area to put code in so that formatting is reatained, this makes code much easier to read,&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370469#M88468</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T10:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370471#M88470</link>
      <description>&lt;P&gt;Sorry, &lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;I had not read well your programm&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370471#M88470</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T10:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370485#M88476</link>
      <description>&lt;P&gt;I'm not english spoken, and I don't understand when you say " you will find next to the Post button on new questions" ... I understood the rest&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 11:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370485#M88476</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370501#M88482</link>
      <description>&lt;P&gt;No problems. &amp;nbsp;When you start a new topic, below the post area is a couple of buttons, Post and Cancel. &amp;nbsp;Should look like this:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9847iD2D56BF4187B5131/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Principally the third element. &amp;nbsp;Include code and data (as a datastep with datalines), so that we have something to run against.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 12:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370501#M88482</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T12:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370507#M88485</link>
      <description>&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Ok&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;In reality, I want to show only the total columns because there is a lot of columns&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Here, the grouping doesn't work &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;sum(tab14_16unionRep._2016total, tab14_16unionRep._2015total, tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Here, the grouping is OK, but there is no summation if no values&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;sum(tab14_16unionRep._2016total) + sum(tab14_16unionRep._2015total) + sum(tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 12:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370507#M88485</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T12:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370511#M88487</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150975"&gt;@eric232&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;suggested to you:&lt;/P&gt;
&lt;P&gt;1. Provide a data step which creates sample data&lt;/P&gt;
&lt;P&gt;2. Explain us what you want and what's currently not working&lt;/P&gt;
&lt;P&gt;3. Show us the desired result based on the sample data you've provided&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you ask questions this way then you put us into a situation where we can much better understand what you have and what you need AND you give us the data so we can provide you with tested code which actually creates your desired result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Asking questions this way takes you a bit more time but it will reduce&amp;nbsp;missunderstandings&amp;nbsp;significantly and you'll get normally the "right" answer much quicker.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 22:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370511#M88487</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-06-26T22:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370538#M88499</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;OK&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab14_16unionRep;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; code KNIV groupe _2016total _2015total _2014total;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01022701 5 227 9 8 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01033401 5 227 . 7 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32022710 3 227 21 31 11&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024002 3 240 12 . .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024005 3 240 . 14 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" 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;&lt;FONT face="Courier New" color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab14_16unionSort;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; code&amp;nbsp; _2016total _2015total _2014total;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01022701 11.12 13.25 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01033401&amp;nbsp; . 10.23 15.21&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32022710&amp;nbsp; 21.24 31.68 11.47&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024002&amp;nbsp; 13.36 . .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;32024005&amp;nbsp; . 15.11 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#000080" 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;The result I need :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 36&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 26&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;What my 2 programs done :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;proc sql;&lt;BR /&gt;create table Tab14_16GrpNiv2 as select&amp;nbsp; KNIV, groupe,&lt;BR /&gt;/* sum(tab14_16unionRep._2016total, tab14_16unionRep._2015total, tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&amp;nbsp; */&lt;BR /&gt;sum(tab14_16unionRep._2016total) + sum(tab14_16unionRep._2015total) + sum(tab14_16unionRep._2014total)&amp;nbsp; as NbRep14_16&lt;BR /&gt;from tab14_16unionSort&amp;nbsp; inner join tab14_16unionRep on tab14_16unionSort.diplome_pre = tab14_16unionRep.diplome_pre&lt;BR /&gt;Group by KNIV, groupe;&lt;BR /&gt;quit;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 19&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 14&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;or&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;5 227 36&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 227 63&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;3 240 .&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;PS : &lt;SPAN class=""&gt;Providing a data set allowed me understand &lt;STRONG&gt;better &lt;/STRONG&gt;(I'm a beginner in SAS, but no in MS Access SQL)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 13:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370538#M88499</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T13:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370603#M88516</link>
      <description>&lt;P&gt;Well, I have no idea what the second dataset is for. &amp;nbsp;This code gets you the desired output:&lt;/P&gt;
&lt;PRE&gt;data tab14_16unionRep;
  input code kniv groupe _2016total _2015total _2014total;
datalines;
01022701 5 227 9 8 .
01033401 5 227 . 7 12
32022710 3 227 21 31 11
32024002 3 240 12 . .
32024005 3 240 . 14 .
;
run;

proc sql;
  create table WANT as
  select  KNIV,
          GROUPE,
          sum(ROW) as RESULT
  from    (select  KNIV,
                   GROUPE,
                   sum(_2016TOTAL,_2015TOTAL,_2014TOTAL) as ROW
           from    TAB14_16UNIONREP)
  group by KNIV,
           GROUPE;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2017 14:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370603#M88516</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T14:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370634#M88522</link>
      <description>&lt;P&gt;Thank you very much. Il will use these&amp;nbsp;two requests.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Does this mean that SAS does not allow summation with a single request ? Because with Access SQL it's possible to use the function Nz to avoid the missing values&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 15:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370634#M88522</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-26T15:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370645#M88524</link>
      <description>&lt;P&gt;Sorry, its not clear what you are saying. &amp;nbsp;The SQL I provided has the subquery as you are both summing across variables, and down through observations. &amp;nbsp;This is a data modelling choice made by you and your data. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;The function Nz you refer to in Access is a simplified case when statement - this is a logical assignment function, nothing to do with aggregates which is the basis of your question.&lt;/P&gt;
&lt;P&gt;ANSI SQL (which all programs implement) support summation upon columns - this is called aggregation. &amp;nbsp;If all your data were in columns then it would be a simple sum() however your data isn't:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01022701 5 227 9 8 .&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;01033401 5 227 . 7 12&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;As you can see from the above, you are both summing() 9, 8, ., and ., 7, 12 across the observations, then summing those two totals together in the group. &amp;nbsp;A better modelling technique would have been to have the data as:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CODE &amp;nbsp; &amp;nbsp; KNIV &amp;nbsp;GROUPE &amp;nbsp;YEAR &amp;nbsp;RESULT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;01022701 5 &amp;nbsp; &amp;nbsp; 227 &amp;nbsp; &amp;nbsp; 2015 &amp;nbsp;8&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;01022701 5 &amp;nbsp; &amp;nbsp; 227 &amp;nbsp; &amp;nbsp; 2016 &amp;nbsp;9&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;The reason is twofold, firstly you can do summing simply then as you only have one column to sum() by your groups. &amp;nbsp;Secondly from a data point of view you do not need to have obervations for 2014 first code and 2016 second code.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 16:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370645#M88524</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T16:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370685#M88535</link>
      <description>&lt;P&gt;To add multiple values together and ignore the missing values you can use the SAS function SUM(,). &amp;nbsp;Note that this is a different function than that SQL aggregate function SUM(). &amp;nbsp;In SQL you can take aggregates of a single variable, SUM(), MEAN(), etc. But the SAS function SUM(,), MEAN(,) etc are designed to work on a single observation and take TWO or MORE arguments. &amp;nbsp;That is how you and the SAS compiler can tell them apart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example you appear to what to sum the individual sums. So you could either use the SAS SUM(,) function to add the values generated by the SQL aggregate function SUM() or do the reverse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this example program the last three variables should have the same value which will be the sum of the first two variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table want as
  select sum(x) as sum_x
       , sum(Y) as sum_y
       , sum( sum(x) , sum(y) ) as sum_xy
       , sum( sum(x,y) ) as sum_xy2
       , sum( calculated sum_x, calculated sum_y) as sum_xy3
  from have
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2017 17:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370685#M88535</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-26T17:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370844#M88559</link>
      <description>&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;You are right&lt;/SPAN&gt;&lt;/SPAN&gt;, The function Nz have nothing to do with aggregates&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 09:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370844#M88559</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-27T09:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370845#M88560</link>
      <description>&lt;P&gt;Thank you, the two codes work&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;y&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as sum_xy
       &lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;y&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as sum_xy2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 09:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-with-missing-value/m-p/370845#M88560</guid>
      <dc:creator>eric232</dc:creator>
      <dc:date>2017-06-27T09:02:49Z</dc:date>
    </item>
  </channel>
</rss>

