<?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 Sum of Count in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714829#M27324</link>
    <description>&lt;P&gt;I want to do a sum of count of 3 tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 1&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnA&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;10&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnB&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;8&lt;/P&gt;
&lt;P&gt;13&lt;/P&gt;
&lt;P&gt;34&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 3&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnC&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;20&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;17&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to do a sum of the count of the 3 tables i.e.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum (count(ColumnA) + count(columnB) + count(columnC)) as "Final Sum"&lt;/P&gt;
&lt;P&gt;Sum (4 +3 +5)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My final output should be&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Final Sum&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 22:14:36 GMT</pubDate>
    <dc:creator>SAS_New_User1</dc:creator>
    <dc:date>2021-01-27T22:14:36Z</dc:date>
    <item>
      <title>Sum of Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714829#M27324</link>
      <description>&lt;P&gt;I want to do a sum of count of 3 tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 1&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnA&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;10&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnB&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;8&lt;/P&gt;
&lt;P&gt;13&lt;/P&gt;
&lt;P&gt;34&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 3&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ColumnC&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;20&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;17&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to do a sum of the count of the 3 tables i.e.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum (count(ColumnA) + count(columnB) + count(columnC)) as "Final Sum"&lt;/P&gt;
&lt;P&gt;Sum (4 +3 +5)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My final output should be&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Final Sum&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 22:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714829#M27324</guid>
      <dc:creator>SAS_New_User1</dc:creator>
      <dc:date>2021-01-27T22:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714830#M27325</link>
      <description>&lt;P&gt;How do you want your final output--as a dataset, or a printed value?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here's one way to do it--counting the total number of rows from those three datasets. This code will save the final sum to a macro variable, and print it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
    input columnA;
    datalines;
    12
    10
    5
    6
    ;
run;

data table2;
    input columnB;
    datalines;
    8
    13
    34
    ;
run;

data table3;
    input columnC;
    datalines;
    20
    2
    24
    1
    17
    ;
run;

/* Combine table1, table2 and table3 */
data have;
    set table1 table2 table3;
run;

/* Put the total Final Sum in a macro variable */
proc sql;
    select count(*) into :final_sum
    from have;
quit;

%put The Final Sum is: &amp;amp;final_sum.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jan 2021 22:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714830#M27325</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2021-01-27T22:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714837#M27326</link>
      <description>Will it always be three tables?&lt;BR /&gt;Do the table names have anything in common?&lt;BR /&gt;&lt;BR /&gt;You can use the table dictionary.table or sashelp.vtable that contain the # of rows of each table and sum the number from that table. &lt;BR /&gt;&lt;BR /&gt;proc means data=sashelp.vtable (where=(memname = 'WORK' and libname like 'TABLE%')) sum;&lt;BR /&gt;var nobs;&lt;BR /&gt;output out=want SUM=TOTAL_OBS;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;This pipes the output to a data set called WANT.</description>
      <pubDate>Wed, 27 Jan 2021 23:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714837#M27326</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-27T23:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714917#M27334</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select sum(nobs) as final_count
from dictionary.tables
where libname = "WORK" and memname in ("TABLE1","TABLE2","TABLE3");
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use an appropriate WHERE clause.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 09:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sum-of-Count/m-p/714917#M27334</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-28T09:21:56Z</dc:date>
    </item>
  </channel>
</rss>

