<?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: Hash Output to update the Initial Dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479557#M71470</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221594"&gt;@jpm2478&lt;/a&gt;&amp;nbsp;If your question relates to the thread&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Compare-two-datasets-using-Hash-and-update-values/m-p/478856#M71415&amp;nbsp;" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Compare-two-datasets-using-Hash-and-update-values/m-p/478856#M71415&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try options 1. modify statement, 2.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;'s non hash solution among others etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course if you are comfortable with hashes, by all means do explore. Hash understanding is tricky for the reason understanding&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PDV::Memory table&amp;nbsp; &amp;nbsp;key value pair matches can be confusing and pulling from&amp;nbsp;&lt;SPAN&gt;Memory table ::&amp;nbsp; PDV along with it can be daunting. But&amp;nbsp; totally up to you&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 16:09:24 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-07-19T16:09:24Z</dc:date>
    <item>
      <title>Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479551#M71468</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Hash Object and I'm trying to get the Output to overwrite the initial dataset (Y). I'm using&amp;nbsp;&amp;nbsp;if last then h.output(dataset:'work.y');&lt;/P&gt;&lt;P&gt;where work.Y is an initial dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code the Output is not shown in Work.Y but when I use a newdataset name like&amp;nbsp;&amp;nbsp;if last then h.output(dataset:'AA'); the output is shown in new dataset AA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get Hash Output to be shown on the Initial Dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 15:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479551#M71468</guid>
      <dc:creator>jpm2478</dc:creator>
      <dc:date>2018-07-19T15:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479553#M71469</link>
      <description>&lt;P&gt;Are you trying to update a dataset using the values from other dataset?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this if so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;  
  if _n_=1 then do;
    declare hash ud(dataset:'update');
    ud.defineKey('id');
    ud.defineData('val1', 'val2');
    ud.defineDone();
  end;
  modify have;
  rcUpdate = ud.find();
  if rcUpdate=0 then replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jul 2018 16:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479553#M71469</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-07-19T16:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479557#M71470</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221594"&gt;@jpm2478&lt;/a&gt;&amp;nbsp;If your question relates to the thread&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Compare-two-datasets-using-Hash-and-update-values/m-p/478856#M71415&amp;nbsp;" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Compare-two-datasets-using-Hash-and-update-values/m-p/478856#M71415&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try options 1. modify statement, 2.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;'s non hash solution among others etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course if you are comfortable with hashes, by all means do explore. Hash understanding is tricky for the reason understanding&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PDV::Memory table&amp;nbsp; &amp;nbsp;key value pair matches can be confusing and pulling from&amp;nbsp;&lt;SPAN&gt;Memory table ::&amp;nbsp; PDV along with it can be daunting. But&amp;nbsp; totally up to you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 16:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479557#M71470</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-19T16:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479558#M71471</link>
      <description>&lt;P&gt;Are you trying to use hash output method to overwrite a data set that your are reading from in the same data step?&amp;nbsp;&amp;nbsp; I don't believe you can do that.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 16:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479558#M71471</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-19T16:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479561#M71472</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;Sir, I believe that's exactly OP's req. I wish I was brilliant using modify statement and automatic vars associated with it like you demonstrated in one your posts which I regret I failed to add to my notes. If i had it, I would have plagiarized it and demonstrated here3&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 16:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479561#M71472</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-19T16:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Output to update the Initial Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479609#M71484</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be referring to &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Update-and-replace-data-in-a-table/m-p/476069#M58255" target="_self"&gt;Update and replace data in a table&lt;/A&gt;, but that problem was only to decide whether to replace the last record in the master, or to append the record.&amp;nbsp; I think this problem has to do with multiple transaction/update records.&amp;nbsp; In which case &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;'s solution seems apt - as long as the UPDATE dataset has only one record per id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edited revision:&amp;nbsp; ... and also assuming that there are no new id's in UPDATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 17:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-Output-to-update-the-Initial-Dataset/m-p/479609#M71484</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-19T17:56:44Z</dc:date>
    </item>
  </channel>
</rss>

