<?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 output sum of a varable in the same dataset in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136363#M1998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually disagree with this.&amp;nbsp; A case in point is my deliverables, I always store a dataset almost exactly as it is shown in the output, so that this can be independently QC'd.&amp;nbsp; Reduces the amount of QC done on the output file.&amp;nbsp; Of course this wouldn't alter the source data, just the processed data going into the output files.&amp;nbsp; Of course, something simple like this you could do with proc report for instance and have that output a dataset, however as it gets more complicated...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jan 2015 13:12:03 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-01-26T13:12:03Z</dc:date>
    <item>
      <title>How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136359#M1994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Every one, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data A is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="172"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="86"&gt;Date &lt;/TD&gt;&lt;TD class="xl65" width="86"&gt;AZ&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2015&lt;/TD&gt;&lt;TD class="xl65"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2016&lt;/TD&gt;&lt;TD class="xl65"&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2017&lt;/TD&gt;&lt;TD class="xl65"&gt;41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2018&lt;/TD&gt;&lt;TD class="xl65"&gt;41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2019&lt;/TD&gt;&lt;TD class="xl65"&gt;46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2020&lt;/TD&gt;&lt;TD class="xl65"&gt;65&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2021&lt;/TD&gt;&lt;TD class="xl65"&gt;43&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2022&lt;/TD&gt;&lt;TD class="xl65"&gt;59&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want it to be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 172px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="86"&gt;Date &lt;/TD&gt;&lt;TD class="xl65" width="86"&gt;AZ&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2015&lt;/TD&gt;&lt;TD class="xl65"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2016&lt;/TD&gt;&lt;TD class="xl65"&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2017&lt;/TD&gt;&lt;TD class="xl65"&gt;41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2018&lt;/TD&gt;&lt;TD class="xl65"&gt;41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2019&lt;/TD&gt;&lt;TD class="xl65"&gt;46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2020&lt;/TD&gt;&lt;TD class="xl65"&gt;65&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2021&lt;/TD&gt;&lt;TD class="xl65"&gt;43&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1/1/2022&lt;/TD&gt;&lt;TD class="xl65"&gt;59&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;Total&lt;/TD&gt;&lt;TD class="xl65"&gt;350&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 00:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136359#M1994</guid>
      <dc:creator>jjjunyi</dc:creator>
      <dc:date>2015-01-24T00:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136360#M1995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The are many ways of how to achieve this (proc print, proc report, proc tabulate, proc sql, proc summary, ....). What have you tried so far and where did you get stuck?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 00:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136360#M1995</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-01-24T00:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136361#M1996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If date variable is character type, that would be easy. otherwise you need other skill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
data have;
input Date : $20.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AZ ;
cards;
1/1/2015&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10
1/1/2016&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;45
1/1/2017&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;41
1/1/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;41
1/1/2019&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;46
1/1/2020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;65
1/1/2021&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;43
1/1/2022&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;59
;
run;
data want;
 set have end=last;
 sum+az;output;
 if last then do;
&amp;nbsp;&amp;nbsp; date='Total';az=sum;output;
 end;
 drop sum;
run;

&lt;/PRE&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;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 08:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136361#M1996</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-24T08:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136362#M1997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please, don't store totals in the same table as the detail data.&lt;/P&gt;&lt;P&gt;As Patrick suggests, creating totals is the work for reports, not data manipulation steps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 12:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136362#M1997</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-01-26T12:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136363#M1998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually disagree with this.&amp;nbsp; A case in point is my deliverables, I always store a dataset almost exactly as it is shown in the output, so that this can be independently QC'd.&amp;nbsp; Reduces the amount of QC done on the output file.&amp;nbsp; Of course this wouldn't alter the source data, just the processed data going into the output files.&amp;nbsp; Of course, something simple like this you could do with proc report for instance and have that output a dataset, however as it gets more complicated...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136363#M1998</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-26T13:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136364#M1999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Storing summary rows in a table is... let's call it "very uncommon" and I would assume you'd be pretty alone with such an approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 08:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136364#M1999</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-01-27T08:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136365#M2000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I strongly side with LInus and Patrick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've had considerable experience with managing aggregated data stores, and this architecture will greatly increase the chances that you'll produce incorrect summarized results in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you're going to do this, use something like the _TYPE_ variable that PROC MEANS creates, to provide an unambiguous indication of the role that each row plays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 14:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136365#M2000</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-01-27T14:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136366#M2001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Possibly a difference in industries/usage there then.&amp;nbsp; My outputs are of the form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;col1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; treat1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; treat2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; total&lt;/P&gt;&lt;P&gt;xyz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n (n%)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n (n%)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n (%)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And some other slightly more complicated.&amp;nbsp; I am not for a moment suggesting this should be stored in a data warehouse or what not, this is purely a dataset to support an output, and whilst with some compute blocks you may be able to get the aforementioned output we need to retain a useable copy of this so an independent QC programmer can re-create the same data for a comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, I am not changing the raw data, merely the output supporting dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 14:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136366#M2001</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-27T14:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to output sum of a varable in the same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136367#M2002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For temporary tables which existence is purely for report out, then it serves a purpose.&lt;/P&gt;&lt;P&gt;So perhaps we agree on this matter for the main situations...? &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 15:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-output-sum-of-a-varable-in-the-same-dataset/m-p/136367#M2002</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-01-27T15:06:39Z</dc:date>
    </item>
  </channel>
</rss>

