<?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 How to use SUM(of var1-varn) in macro in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-SUM-of-var1-varn-in-macro/m-p/17154#M3227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you would want to put this in a macro, or the result in a macro variable, but I think that the following does what you describe:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input&amp;nbsp; telco_enq85-telco_enq90;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global total;&lt;/P&gt;&lt;P&gt;%MACRO Distribution(var);&lt;/P&gt;&lt;P&gt;&amp;nbsp; DATA test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total=SUM(of &amp;amp;var.:);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('total',total);&lt;/P&gt;&lt;P&gt;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Distribution(telco_enq)&lt;/P&gt;&lt;P&gt;%put &amp;amp;total.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Sep 2011 04:20:52 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-09-27T04:20:52Z</dc:date>
    <item>
      <title>How to use SUM(of var1-varn) in macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-SUM-of-var1-varn-in-macro/m-p/17153#M3226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset that contains sequentially named&amp;nbsp; variables called telco_enq083, telco_enq084.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a macro that works out the horizontal sum of these variables for each observation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, test dataset is an extract of a much bigger dataset and I have more sequential variables(Full dataset has columns that look like -&lt;/P&gt;&lt;P&gt;telco_enq083, telco_enq084, telco_enq091, telco_enq092, telco_enq093, telco_enq094, telco_enq101... etc)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you modify the below macro to make it work? I have tried %SYSFUNC and it does not work and SAS says it cannot read the argument of the SUM function...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET a=telco_enq;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; Distribution(var);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA test2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 36pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 36pt; margin: 0px 0px 0px 36pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; Total=SUM(of &amp;amp;var:);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MEND&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Distribution(a);&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 04:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-SUM-of-var1-varn-in-macro/m-p/17153#M3226</guid>
      <dc:creator>willy0625</dc:creator>
      <dc:date>2011-09-27T04:05:44Z</dc:date>
    </item>
    <item>
      <title>How to use SUM(of var1-varn) in macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-SUM-of-var1-varn-in-macro/m-p/17154#M3227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you would want to put this in a macro, or the result in a macro variable, but I think that the following does what you describe:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input&amp;nbsp; telco_enq85-telco_enq90;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global total;&lt;/P&gt;&lt;P&gt;%MACRO Distribution(var);&lt;/P&gt;&lt;P&gt;&amp;nbsp; DATA test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total=SUM(of &amp;amp;var.:);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('total',total);&lt;/P&gt;&lt;P&gt;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Distribution(telco_enq)&lt;/P&gt;&lt;P&gt;%put &amp;amp;total.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 04:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-SUM-of-var1-varn-in-macro/m-p/17154#M3227</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-27T04:20:52Z</dc:date>
    </item>
  </channel>
</rss>

