<?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 write an accumulation statement so that all the obs in the transaction ds are added to the master ds? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41019#M8402</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My code is very simple and not reliable .&lt;/P&gt;&lt;P&gt;If you want more detail. Check it out at SAS document( SAS/BASE dictionary) ,search MODIFY statement, &lt;/P&gt;&lt;P&gt;you will find lots of examples and explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Mar 2012 06:23:07 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-03-29T06:23:07Z</dc:date>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41014#M8397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On advanced certification book, it says to update record using transaction dataset and by method. &lt;/P&gt;&lt;P&gt;book suggests we &lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;write an accumulation statement so that all the obs inthe transaction ds are added to the master observation? I am using following example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Following code trans dataset, 13 is a dup, 2nd 13 was writen to mas data set, which is not right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mas;&lt;/P&gt;&lt;P&gt;input id var1 $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;12 fish&lt;/P&gt;&lt;P&gt;13 pole&lt;/P&gt;&lt;P&gt;14 system&lt;/P&gt;&lt;P&gt;15 new&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data trans;&lt;/P&gt;&lt;P&gt;input id var1 $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;13 ab&lt;/P&gt;&lt;P&gt;13 cd&lt;/P&gt;&lt;P&gt;14 book&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mas;&lt;/P&gt;&lt;P&gt;modify mas trans;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=mas;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 05:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41014#M8397</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-23T05:14:32Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41015#M8398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it what you need?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data mas;
input id var1 $;
cards;
12 fish
13 pole
14 system
15 new
;

 

data trans;
input id var1 $;
cards;
13 ab
13 cd
14 book
;

 

data mas; 
modify mas trans ;
by id;
select(_iorc_); 
&amp;nbsp; when(%sysrc(_sok))&amp;nbsp; output;
&amp;nbsp; when(%sysrc(_dsenom)) do;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _error_ = 0;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
&amp;nbsp; otherwise ;
end;
run;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 08:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41015#M8398</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-23T08:59:22Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41016#M8399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you know exactly what "&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;an accumulation statement&lt;/SPAN&gt;" is?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 14:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41016#M8399</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-23T14:10:24Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41017#M8400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An accumulation statement is used to update values in a master dataset from a transaction dataset (e.g. stock number) where duplicate id's exist.&amp;nbsp; In your example there isn't such a numeric field and therefore an accumulation statement can't be used.&lt;/P&gt;&lt;P&gt;Below is a link to the SAS documentation on using the MODIFY statement, take a look at example 5 which demonstrates using an accumulation statement to deal with duplicate values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173361.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173361.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 15:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41017#M8400</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2012-03-23T15:45:14Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41018#M8401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have couple of questions regarding your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_dsenom is for updating records using index, should it be &lt;EM style="font-size: 8.5pt; font-family: NewCenturySchlbk-Italic;"&gt;_DSEMTR?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand the purpose of&amp;nbsp; "otherwise ;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, why do we have two output statments?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 01:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41018#M8401</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-29T01:42:40Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41019#M8402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My code is very simple and not reliable .&lt;/P&gt;&lt;P&gt;If you want more detail. Check it out at SAS document( SAS/BASE dictionary) ,search MODIFY statement, &lt;/P&gt;&lt;P&gt;you will find lots of examples and explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 06:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41019#M8402</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-29T06:23:07Z</dc:date>
    </item>
    <item>
      <title>how to write an accumulation statement so that all the obs in the transaction ds are added to the master ds?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41020#M8403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess is that the problem is one of arithmetic accumulation. The UPDATE and MODIFY statements can handle this, but it gets tricky if the variable to be incremented in the master data set and the increments in the transaction data set have the same name. A RENAME is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; master ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;input&lt;/SPAN&gt; ID HowMuch ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #0000ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;98&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;99 1000&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; transaction ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;input&lt;/SPAN&gt; ID HowMuch ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #0000ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;98&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;99&amp;nbsp; 200&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;99&amp;nbsp;&amp;nbsp; 30&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;99&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; master ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;modify&lt;/SPAN&gt; master&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transaction( rename = HowMuch=increment ) ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt; ID ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;HowMuch + increment ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;ZRick wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know exactly what "&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;an accumulation statement&lt;/SPAN&gt;" is?&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 20:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-write-an-accumulation-statement-so-that-all-the-obs-in/m-p/41020#M8403</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2012-04-02T20:13:43Z</dc:date>
    </item>
  </channel>
</rss>

