<?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 of all numeric colums from different tables( from 2 separate libraries as well) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379189#M91245</link>
    <description>&lt;P&gt;If the numbers get too large with the sum you're going to have numerical precision issues.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 19:45:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-25T19:45:51Z</dc:date>
    <item>
      <title>Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379169#M91234</link>
      <description>&lt;P&gt;Hello mates &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I am trying to develop a SAS Data Set that sums all the numeric columns from different tables.&lt;/P&gt;&lt;P&gt;Those tables are part of 2 separate libraries as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, I have to compare them.&lt;/P&gt;&lt;P&gt;One of the library(for example "da") contains all the input tables for the other library(for example "dada").&lt;/P&gt;&lt;P&gt;So I need to make sure that for each table from the input library("da") &amp;nbsp;the sum is equal with the sum from the target table(from "dada").&lt;/P&gt;&lt;P&gt;I am a beginner so I need help with this script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your support!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379169#M91234</guid>
      <dc:creator>Maker10</dc:creator>
      <dc:date>2017-07-25T19:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379175#M91236</link>
      <description>&lt;P&gt;Can you lay out the steps you need to do in clear order please?&lt;/P&gt;
&lt;P&gt;Number them, if that helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379175#M91236</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-25T19:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379179#M91238</link>
      <description>&lt;P&gt;Thank you for your response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I need to sum all the numeric columns from the tables in the target library ("da")&lt;/P&gt;&lt;P&gt;2. I need to sum all the numeric columns from the tables in the input library ("dada")&lt;/P&gt;&lt;P&gt;3. I need to check which columns from the library "dada" are input for the columns from library "da"&lt;/P&gt;&lt;P&gt;4. Based on that check I need to compare the sums from the input columns from library "dada" with the sums from the target tables from the library "da"&lt;/P&gt;&lt;P&gt;5. Deliver the report&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379179#M91238</guid>
      <dc:creator>Maker10</dc:creator>
      <dc:date>2017-07-25T19:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379184#M91242</link>
      <description>&lt;P&gt;Are all tables of the same format?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Numeric variables can contain dates? Do you wan to sum them also?&lt;/P&gt;
&lt;P&gt;Some code variables also may be numeric. D&lt;SPAN&gt;o you wan to sum them also?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Do yo want to compare each variable separately? or the total sum per library?&lt;/P&gt;
&lt;P&gt;What are the names of the tables? do they have same format or convention?&lt;/P&gt;
&lt;P&gt;What report format do you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you expect? A method or a code to do it?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379184#M91242</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-25T19:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379187#M91243</link>
      <description>&lt;P&gt;Thank you for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. No, the tables do not have the same format&lt;/P&gt;&lt;P&gt;2. Yes, they contain dates and I want to sum them also&lt;/P&gt;&lt;P&gt;3. I want to sum the code variables also.&lt;/P&gt;&lt;P&gt;4. I want to compare the total sum per table ( input table compared to target table)&lt;/P&gt;&lt;P&gt;5. I can't divulge the name of the tables unfortunatelly &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;6. I want the report to be a SAS Table&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379187#M91243</guid>
      <dc:creator>Maker10</dc:creator>
      <dc:date>2017-07-25T19:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379188#M91244</link>
      <description>&lt;P&gt;Step 3 is vague, you'll have to show how that should work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the tables are unique and you can't stack them, you have to loop through all, which is a pain of course.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Get a list of tables in library da/dada -&amp;gt; use sashelp.vtable for this&lt;/P&gt;
&lt;P&gt;2. Create a macro that creates your summary stats and appends them to a master table.&lt;/P&gt;
&lt;P&gt;3. Use call execute to call macro based on data from #1. See Call Execute documentation for an example.&lt;/P&gt;
&lt;P&gt;4. Merge or proc compare the outputs required.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379188#M91244</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-25T19:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379189#M91245</link>
      <description>&lt;P&gt;If the numbers get too large with the sum you're going to have numerical precision issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379189#M91245</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-25T19:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379191#M91246</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I loop through all? &amp;nbsp;Because this will ease my work. I wanted to call the macro "n" times with all the names of the tables from the 2 libraries.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i could loop somehow through them, it would be awesome!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 19:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379191#M91246</guid>
      <dc:creator>Maker10</dc:creator>
      <dc:date>2017-07-25T19:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379196#M91249</link>
      <description>&lt;P&gt;See Step #3 - do not loop, use call execute.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 20:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379196#M91249</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-25T20:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379200#M91252</link>
      <description>&lt;P&gt;Here is a macro code to sum all numeric variables of a given table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro sum(dsnin,dsnout);   &lt;BR /&gt;data &amp;amp;dsnout;         /* dsnout isdataset name contaning the total */
 set &amp;amp;dsnin end=eof;  /* dsnin is either da.xxx or dada.xxx where xxx is any given dataset name */
       retain total 0;
       array nums _numeric_;
       do i=1 to dim(nums);
            tot = sum(of tot, nums(i));
       end;
       total = sum(of toatl, tot);
       if eof then output;
       keep total;
run;&lt;BR /&gt;%mend sum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;next is a macro to sum and compare the totals of two comparable tables, using above macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rep(da_table, dada_table);
    %sum(&amp;amp;da_table, sum_da);
    %sum(&amp;amp;dada_table, sum_dada);
   data totals;
      merge sum_da (rename=(total = da_sum))
            sum_dada(rename=(total=dad_sum));
      by;
      table_da = "&amp;amp;da_table";
      table_dada = "&amp;amp;dada_table";
  run;
  proc append base=report data=totals;   /* assuming report is the dataset name to contain the report */
  run;&lt;BR /&gt;%mend rep;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;finally run next code to get the report as dataset :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc dataset lib=work nolist; delete report; run; quit;

%rep(...1st pair of datasets...);
%rep(...2nd pair of datsets...);
... etc. ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2017 20:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379200#M91252</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-25T20:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of all numeric colums from different tables( from 2 separate libraries as well)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379215#M91260</link>
      <description>&lt;P&gt;I assumed the requirement was to sum each variable individually...is it each variable or all numerics into one sum? If so, and you're trying to ensure the file is the same there are better ways.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 21:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-of-all-numeric-colums-from-different-tables-from-2-separate/m-p/379215#M91260</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-25T21:19:30Z</dc:date>
    </item>
  </channel>
</rss>

