<?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: i have 100 variable i need sum of variable column wise in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789405#M252601</link>
    <description>&lt;P&gt;What do you need exactly as result? A dataset with the sums? Html-Output? The sums appended to the dataset you have?&lt;/P&gt;
&lt;P&gt;Using proc summary is highly recommended, but if you can use IML, this maybe a good point to start, because it is designed to work with matrices.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   use work.a;
   read all var _num_ into have;
   close work.a;
   
   want = have[+,];
   print want;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Jan 2022 06:49:06 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-01-11T06:49:06Z</dc:date>
    <item>
      <title>i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789399#M252596</link>
      <description>&lt;P&gt;i can do this using proc sql but my variables are 100 so it will take lot of time .Is their any other way so that i haven't to wright 100 variable in select statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;
&lt;P&gt;input s1 s2 s3 s4;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; 2&amp;nbsp; 3 4&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; 2&amp;nbsp; 4&amp;nbsp; 5&lt;/P&gt;
&lt;P&gt;9&amp;nbsp; 9&amp;nbsp; 9&amp;nbsp; 9&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;output&lt;/P&gt;
&lt;P&gt;s1&amp;nbsp; s2&amp;nbsp; s3&amp;nbsp; s4&lt;/P&gt;
&lt;P&gt;12 13&amp;nbsp; 16&amp;nbsp; &amp;nbsp;18&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 04:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789399#M252596</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-01-11T04:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789401#M252597</link>
      <description>&lt;P&gt;This is where&amp;nbsp;the various analysis and reporting PROCs in SAS excel.&amp;nbsp; In your case, it would be PROC SUMMARY:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  input s1 s2 s3 s4;
datalines;
1  2  3 4
2  2  4  5
9  9  9  9
run;
proc summary data=a  ;
  var s1-s4;
  output out=want (drop=_type_ _freq_)  sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2022 05:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789401#M252597</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-01-11T05:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789402#M252598</link>
      <description>&lt;P&gt;Assuming your variables are named s1 to s100 something like this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data = a sum;
  var s1 - s100;
  output out = a_sum
         sum = ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2022 05:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789402#M252598</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-01-11T05:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789405#M252601</link>
      <description>&lt;P&gt;What do you need exactly as result? A dataset with the sums? Html-Output? The sums appended to the dataset you have?&lt;/P&gt;
&lt;P&gt;Using proc summary is highly recommended, but if you can use IML, this maybe a good point to start, because it is designed to work with matrices.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   use work.a;
   read all var _num_ into have;
   close work.a;
   
   want = have[+,];
   print want;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2022 06:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789405#M252601</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-11T06:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789407#M252603</link>
      <description>&lt;P&gt;Transpose!&lt;/P&gt;
&lt;P&gt;There are just a few scnarios when a wide table make s sense.&lt;/P&gt;
&lt;P&gt;A long table structure is easier to query, optimizes storage etc.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 07:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789407#M252603</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-01-11T07:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: i have 100 variable i need sum of variable column wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789439#M252620</link>
      <description>data a;&lt;BR /&gt;input s1 s2 s3 s4;&lt;BR /&gt;datalines;&lt;BR /&gt;1  2  3 4&lt;BR /&gt;2  2  4  5&lt;BR /&gt;9  9  9  9&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc summary data=a;&lt;BR /&gt;var _numeric_;&lt;BR /&gt;output out=want(drop=_type_ _freq_) sum=;&lt;BR /&gt;run;</description>
      <pubDate>Tue, 11 Jan 2022 11:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-have-100-variable-i-need-sum-of-variable-column-wise/m-p/789439#M252620</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-11T11:42:11Z</dc:date>
    </item>
  </channel>
</rss>

