<?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: When I try to add two columns together SAS generates a missing value on the first record. Why? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812766#M40665</link>
    <description>&lt;P&gt;Move the SET statement to above the SUM&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 18:33:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-05-11T18:33:34Z</dc:date>
    <item>
      <title>When I try to add two columns together SAS generates a missing value on the first record. Why?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812763#M40664</link>
      <description>&lt;P&gt;Hello SAS community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to add two columns together SAS generates a missing value on the first record.&lt;/P&gt;&lt;P&gt;Here is the sample code I'm running using the SAS Help library:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;
sum=sum(vsp,pop);
keep sum vsp pop;
set sashelp.tourism;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am attempting to calculate a sum between two columns, I keep on getting a missing value for the first record of the sum column and the it shift the corresponding sum one record down. See below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mreynaud_0-1652293378606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71343iFD18D2AFC2BAF519/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mreynaud_0-1652293378606.png" alt="mreynaud_0-1652293378606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I want is the sum between two columns all on each respective row:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;sum&lt;/TD&gt;&lt;TD&gt;vsp&lt;/TD&gt;&lt;TD&gt;pop&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;55.9253&lt;/TD&gt;&lt;TD&gt;1.2823&lt;/TD&gt;&lt;TD&gt;54.643&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;56.2308&lt;/TD&gt;&lt;TD&gt;1.2718&lt;/TD&gt;&lt;TD&gt;54.959&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;56.753&lt;/TD&gt;&lt;TD&gt;1.537&lt;/TD&gt;&lt;TD&gt;55.216&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;57.4111&lt;/TD&gt;&lt;TD&gt;1.9501&lt;/TD&gt;&lt;TD&gt;55.461&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;57.462&lt;/TD&gt;&lt;TD&gt;1.83&lt;/TD&gt;&lt;TD&gt;55.632&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;58.5406&lt;/TD&gt;&lt;TD&gt;2.6126&lt;/TD&gt;&lt;TD&gt;55.928&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;59.2325&lt;/TD&gt;&lt;TD&gt;3.1535&lt;/TD&gt;&lt;TD&gt;56.079&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;59.2831&lt;/TD&gt;&lt;TD&gt;3.0601&lt;/TD&gt;&lt;TD&gt;56.223&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;58.8326&lt;/TD&gt;&lt;TD&gt;2.5966&lt;/TD&gt;&lt;TD&gt;56.236&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;59.1075&lt;/TD&gt;&lt;TD&gt;2.8815&lt;/TD&gt;&lt;TD&gt;56.226&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;58.3674&lt;/TD&gt;&lt;TD&gt;2.1514&lt;/TD&gt;&lt;TD&gt;56.216&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;58.734&lt;/TD&gt;&lt;TD&gt;2.544&lt;/TD&gt;&lt;TD&gt;56.19&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help! I've tried using coalesce with the sum but all it did was is convert the missing value into a zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 18:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812763#M40664</guid>
      <dc:creator>mreynaud</dc:creator>
      <dc:date>2022-05-11T18:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: When I try to add two columns together SAS generates a missing value on the first record. Why?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812766#M40665</link>
      <description>&lt;P&gt;Move the SET statement to above the SUM&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 18:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812766#M40665</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-11T18:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: When I try to add two columns together SAS generates a missing value on the first record. Why?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812768#M40666</link>
      <description>&lt;P&gt;It is very hard for SAS to add values together BEFORE it actually HAS the values!&lt;/P&gt;
&lt;P&gt;Fix the order of your statements so they make sense.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set sashelp.tourism;
  sum=sum(vsp,pop);
  keep sum vsp pop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 May 2022 18:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/When-I-try-to-add-two-columns-together-SAS-generates-a-missing/m-p/812768#M40666</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-11T18:34:51Z</dc:date>
    </item>
  </channel>
</rss>

