<?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: how to sum all numeric variables in sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530460#M145076</link>
    <description>&lt;P&gt;SQL server is not the same as SAS.&lt;/P&gt;
&lt;P&gt;Let SAS do the heavy work and then push the results to the SQL server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Jan 2019 14:04:38 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2019-01-27T14:04:38Z</dc:date>
    <item>
      <title>how to sum all numeric variables in sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530432#M145059</link>
      <description>&lt;P&gt;how to sum all numeric variables in sashelp.class write do loop in sql&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 07:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530432#M145059</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-01-27T07:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum all numeric variables in sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530440#M145065</link>
      <description>&lt;P&gt;Why do you want to limit yourself to SQL? There are other procedures better suited for the job. Check out Proc Means or Proc Summary&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 09:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530440#M145065</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-27T09:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum all numeric variables in sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530460#M145076</link>
      <description>&lt;P&gt;SQL server is not the same as SAS.&lt;/P&gt;
&lt;P&gt;Let SAS do the heavy work and then push the results to the SQL server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 14:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530460#M145076</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-01-27T14:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum all numeric variables in sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530494#M145086</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; SAS Procedures like PROC MEANS and PROC TABULATE (and others) support the use of _NUMERIC_ and _CHARACTER_ to deal with all the numeric or all the character variables. I do not believe you can use this syntax shortcut in PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Using SAS procedures you don't need a do loop at all:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="no_do_loop_needed.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26608iA577A7EBACD2DF70/image-size/large?v=v2&amp;amp;px=999" role="button" title="no_do_loop_needed.png" alt="no_do_loop_needed.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; And PROC REPORT would do this too. But&amp;nbsp; I would probably start with PROC MEANS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SQL, you don't need a do loop, but you do need to know the names of the variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select sum(age) as agesum, sum(height) as htsum, sum(weight) as wtsum
  from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 18:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530494#M145086</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-01-27T18:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum all numeric variables in sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530562#M145114</link>
      <description>&lt;P&gt;I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt; already gave you a good answer, but you should also know that there is no such thing as a "do loop" in SQL. This is because SQL is a declarative language (you tell the computer what you want), rather than a procedural language (you tell the computer what to do) like SAS datastep or macro language.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 08:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sum-all-numeric-variables-in-sql/m-p/530562#M145114</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2019-01-28T08:55:30Z</dc:date>
    </item>
  </channel>
</rss>

