<?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: Insert a new variable into dataset, which is the sum total of another variable already in datase in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227088#M5465</link>
    <description>&lt;P&gt;the approach works astounding, but I don't know if it will work for me. In that I will have many more&amp;nbsp;columns to sum and other data steps within this one.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2015 15:09:30 GMT</pubDate>
    <dc:creator>H</dc:creator>
    <dc:date>2015-09-24T15:09:30Z</dc:date>
    <item>
      <title>Insert a new variable into dataset, which is the sum total of another variable already in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227076#M5460</link>
      <description>&lt;P&gt;As easy as sounds.&amp;nbsp; Seems like a proc sql, but I would also be interested in see data step option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; meta;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; A;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datalines&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;8&lt;/P&gt;
&lt;P&gt;14&lt;/P&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;P&gt;8&lt;/P&gt;
&lt;P&gt;16&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Results&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;A&amp;nbsp;&amp;nbsp; B&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;12&amp;nbsp;&amp;nbsp;&amp;nbsp; 83&lt;/P&gt;
&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 83&lt;/P&gt;
&lt;P&gt;14&amp;nbsp;&amp;nbsp;&amp;nbsp; 83&lt;/P&gt;
&lt;P&gt;25&amp;nbsp;&amp;nbsp;&amp;nbsp; 83&lt;/P&gt;
&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;83&lt;/P&gt;
&lt;P&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp; 83&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 14:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227076#M5460</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T14:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227079#M5461</link>
      <description>&lt;P&gt;This is my way too long code so far...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;MEANS&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOPRINT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=meta;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;VAR&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; A;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;OUTPUT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;OUT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=summarydata &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SUM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(A) = sigma_A;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; meta_summary;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;IF&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _N_=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;THEN&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SET&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; summarydata;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SET&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; meta;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;drop&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _type_ _freq_;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=meta_summary;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 14:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227079#M5461</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T14:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227081#M5462</link>
      <description>PS, I no longer see where to click to edit my posts?</description>
      <pubDate>Thu, 24 Sep 2015 14:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227081#M5462</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T14:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227082#M5463</link>
      <description>Here's a DATA step approach: data results; do until (done1); set meta end=done1; B + A; end; do until (done2); set meta end=done2; output; end; run; Good luck.</description>
      <pubDate>Thu, 24 Sep 2015 14:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227082#M5463</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-09-24T14:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227083#M5464</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_8" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/2723" target="_self"&gt;H&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the post you want to edit, click on the "..." in the upper right side and select "edit post/reply."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anna&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:00:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227083#M5464</guid>
      <dc:creator>AnnaBrown</dc:creator>
      <dc:date>2015-09-24T15:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227088#M5465</link>
      <description>&lt;P&gt;the approach works astounding, but I don't know if it will work for me. In that I will have many more&amp;nbsp;columns to sum and other data steps within this one.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227088#M5465</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T15:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227091#M5466</link>
      <description>&lt;P&gt;some reason I thought you could insert the sum back into the dataset within the proc means statement I used.&amp;nbsp; It would use an "in" I believe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any body familiar with that approach?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227091#M5466</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T15:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227115#M5468</link>
      <description>&lt;P&gt;PROC SQL solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table B as
select *, sum(a)
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't think you can add the obs back in with proc means, there may be a way with proc summary though, but I'm unfamiliar with that procedure.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 16:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227115#M5468</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-24T16:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227151#M5470</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you name the new variable in proc sql?&amp;nbsp; It currently gets named "_TEMG001".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say I want to call it Sigma_A.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 20:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227151#M5470</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-09-24T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227292#M5476</link>
      <description>sum(A) as Sigma_A</description>
      <pubDate>Fri, 25 Sep 2015 15:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/227292#M5476</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-25T15:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228457#M5559</link>
      <description>&lt;P&gt;I am using the following to sum two different variables (i.e., A and C):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; B &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; *, sum(A)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; Sigma_A, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; sum(C)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; Sigma_C&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; meta;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;drop&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; D;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;But now&amp;nbsp;I would like to&amp;nbsp;sum them based&amp;nbsp;on a group&amp;nbsp;variable&amp;nbsp;in the dataset called replicate.&amp;nbsp;There are 100 replicate groups (i.e., 1-100) all with 300 observations. I would like to execute the about code but have the sums be for the replicates, and inserted&amp;nbsp;into the new dataset as before.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Any help would be appreciated - I am currently having difficulties getting the "group by"&amp;nbsp;to work with the multiple sums in the step.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 15:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228457#M5559</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-10-05T15:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228461#M5561</link>
      <description>&lt;P&gt;I am now using the following, which works out better for my needs (you can see I am looking at 4 variable sums):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;means&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=summies;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; replicate;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; A B C D;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=LR_test &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(A)= A_sum &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(B)= B_sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(C)= C_sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sum&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(D)= D_sum;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;However, the generated dataset has an extra row for the totals. So it has a replicate&amp;nbsp; = "." with the totals. Plus the 100 other rows with the sums. Is there a way to get rid of this extra within the above data step?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 16:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228461#M5561</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-10-05T16:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228506#M5566</link>
      <description>Use the PROC statement option NWAY.</description>
      <pubDate>Mon, 05 Oct 2015 19:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228506#M5566</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-10-05T19:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a new variable into dataset, which is the sum total of another variable already in datase</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228547#M5570</link>
      <description>&lt;P&gt;H,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Almost all of what you ask for is relatively easy to program. &amp;nbsp;But you will need to set a fixed target, not a moving target. &amp;nbsp;Many replicates? &amp;nbsp;No problem. &amp;nbsp;But a different problem. &amp;nbsp;Name the new fields with "Sigma_"? &amp;nbsp;No problem. &amp;nbsp;But a different problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing you will have to think through is the length of the new variable names. &amp;nbsp;With an original name like "A", there's no problem creating "Sigma_A". &amp;nbsp;But what if the original variable name were 30 characters long? &amp;nbsp;Now there's no room to put "Sigma_" in front.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, spell out a final form to the problem, and the solution won't be that difficult.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 23:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-a-new-variable-into-dataset-which-is-the-sum-total-of/m-p/228547#M5570</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-05T23:15:19Z</dc:date>
    </item>
  </channel>
</rss>

