<?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: Update multiple entries in a master file with a single entry from a 2nd file. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404016#M98207</link>
    <description>&lt;P&gt;My example has already conclusively proven that the merge works if (and that's of course a big IF) your data is consistent. This is why Maxim 3 is so far up in my list.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 16:30:51 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-10-13T16:30:51Z</dc:date>
    <item>
      <title>Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403887#M98157</link>
      <description>&lt;P&gt;I have a sas dataset used as a master file that is accessed with a set of 4 variables to form a key. Each&amp;nbsp;record in the dataset is unique based on the 4 variables, but there can be multiple records with the same values for some of the key variables:&amp;nbsp; EX:&lt;/P&gt;
&lt;P&gt;Key Variables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Host, port, PluginID, CVE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a 2nd file that has some additional variables I wish to add to the master file. The key in this file is just&amp;nbsp; 'HOST'&amp;nbsp;and each record is unique.&amp;nbsp; EX:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Host&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&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; 222&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; 333&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; aaa&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;111&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; 333&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; 444&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried many different ideas on how to apply the updates from file 2 to ALL matching records in file 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Merge, Update, Modify.&amp;nbsp; All of these only apply the update to the 1st occurance in the master file.&amp;nbsp; All other matching occurrances in the master file are not updated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question(Finally):&amp;nbsp; How can I accomplish the above task of updating ALL of the matching records in the master file with the 2nd file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanx for the assist,&lt;/P&gt;
&lt;P&gt;Jim Glover&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403887#M98157</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T12:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403893#M98159</link>
      <description>&lt;P&gt;This done with a simple data step merge:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data master;
input host $ port plugin cve;
cards;
abc 1 1 1
abc 1 1 2
abc 1 2 2
;
run;

data updt;
input host $ newvar1 newvar2 newvar3;
cards;
abc 111 222 333
aaa 111 333 444
;
run;

proc sort data=updt;
by host;
run;

proc sort data=master;
by host port plugin cve;
run;

data want;
merge
  master (in=a)
  updt
;
by host;
if a;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;host    port    plugin    cve    newvar1    newvar2    newvar3

abc       1        1       1       111        222        333  
abc       1        1       2       111        222        333  
abc       1        2       2       111        222        333  
&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403893#M98159</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-13T12:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403898#M98164</link>
      <description>&lt;P&gt;Post test data in the form of a datastep in the body of the post using the code window - {i} above post window.&amp;nbsp; Also show what you want as output so it is clear.&amp;nbsp; Not sure from what you have posted what is to be updated where, perhaps a simple merge of table 2 onto table 1 by host, and then if first.host check the merge data and update the others:&lt;/P&gt;
&lt;PRE&gt;data want;
  merge base (in=a) upd (in=b);
  by host;
  if a;
  if first.host then do;
    post=char(newvar1,1);
    plugin=char(newvar1,2);
    cve=char(newvar1,3);
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403898#M98164</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-13T12:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403927#M98168</link>
      <description>&lt;P&gt;Sorry,&lt;/P&gt;
&lt;P&gt;This solution works the same as all the ones I tried.&amp;nbsp; It only updates the 1st occurrance of the key match in the master file. The rest of the entries in the master with the same Host key were not updated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanx,&lt;/P&gt;
&lt;P&gt;Jim Glover&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403927#M98168</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T14:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403949#M98176</link>
      <description>&lt;P&gt;Sorry, the output example was not listed,&amp;nbsp; Please see below:&lt;/P&gt;
&lt;P&gt;Key Variables - Master File&amp;nbsp; are Host, &amp;nbsp;port, Pluginid, CVE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Host, port, PluginID, CVE&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp; Varx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a 2nd file that has some additional variables I wish to add to the master file. The key in this file is just&amp;nbsp; 'HOST'&amp;nbsp;and each record is unique.&amp;nbsp; EX:&lt;/P&gt;
&lt;P&gt;Key variable&amp;nbsp; -&amp;nbsp; Update File&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt; Host Only&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Host&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; abc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&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; 222&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; 333&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; aaa&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;111&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; 333&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; 444&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output for Updated Master:&lt;/P&gt;
&lt;P&gt;Host&amp;nbsp;&amp;nbsp;&amp;nbsp; Port&amp;nbsp;&amp;nbsp; Pluginid&amp;nbsp;&amp;nbsp; CVE&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp; Varx&amp;nbsp; NewVar1&amp;nbsp;&amp;nbsp; NewVar2&amp;nbsp;&amp;nbsp; NewVar3&lt;/P&gt;
&lt;P&gt;abc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 333&lt;/P&gt;
&lt;P&gt;abc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 333&lt;/P&gt;
&lt;P&gt;abc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;333&lt;/P&gt;
&lt;P&gt;aaa&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;333&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you see, there are move than 1 occurrance of Host("ABC") in the master file, all need to be updated with the data from file2.&amp;nbsp; All the techniques I try only update the 1st occurrance of "ABC" in the master file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this explains it better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanx,&lt;/P&gt;
&lt;P&gt;Jim Glover&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403949#M98176</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T14:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403963#M98181</link>
      <description>&lt;P&gt;Please post examples as datasteps so that we can run it on our machines.&amp;nbsp; For the example you give,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;has provided you the solution.&amp;nbsp; You merge the two datasets based on the key variable host, and the default is many to many join, then you apply the if a condition to restrict it only to the rows in the main table.&amp;nbsp; This is exactly how it should work, therefore please supply examples of&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;exactly&lt;/STRONG&gt;&lt;/U&gt; what data it is and what you are doing, as you can't be following that logic, or your data doesn't look as provided.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:47:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403963#M98181</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-13T14:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403979#M98191</link>
      <description>&lt;P&gt;Here is the code I used:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dm&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'clear log;'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;filename&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mycode &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/sasdata/home/jagc/sasuser.v94/sas_apm/SASCODE1"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; secr &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/sasdata/win_shares/corpfs01/SHARED/CAPACITY/SAS/SAS_APM/Security"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; work.master_101017_update ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;merge&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.MASTER_101017_SORT1_NEW (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=a)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;WORK.OWNER_SORT1&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; host;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;File 2 Contains:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Host&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar3&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;10.4.66.182&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jimmy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tommy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Bobby&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Here is a sample of the output:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Host&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Port&amp;nbsp;&amp;nbsp;Pluginid&amp;nbsp; CVE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Var1&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp; Var3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;NewVar1&amp;nbsp;&amp;nbsp;&amp;nbsp; NewVar2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NewVar3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;10.4.66.182&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp; 35453&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; OpenN&amp;nbsp;570461&amp;nbsp;10/10/17&amp;nbsp;ESS WINDOWS&amp;nbsp; &lt;STRONG&gt;Jimmy&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tommy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Bobby&lt;/STRONG&gt;&lt;BR /&gt;10.4.66.182&amp;nbsp; 445&amp;nbsp; 11457&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; Open&amp;nbsp;244202&amp;nbsp; 09/15/17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;10.4.66.182&amp;nbsp; 445&amp;nbsp; 21725&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; Open&amp;nbsp;244203&amp;nbsp; 09/15/17&amp;nbsp;ESS WINDOWS&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;10.4.66.182&amp;nbsp; 445&amp;nbsp; 25371&amp;nbsp;CVE-2007-0328&amp;nbsp;&amp;nbsp; Open&amp;nbsp;244204&amp;nbsp; 09/15/17&amp;nbsp;ESS WINDOWS&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;10.4.66.18&amp;nbsp;&amp;nbsp; 445&amp;nbsp; 27599&amp;nbsp;CVE-2007-5660&amp;nbsp;&amp;nbsp; Open&amp;nbsp;244205&amp;nbsp; 09/15/17&amp;nbsp;ESS WINDOWS&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;You can see that the host(10.4.66.182) has multiple entries in the master file, but only the 1st occurrance of that Host was updated with the new variables(NewVar1,NewVar2,NewVar3) The other occurrances of that host were not updated&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;Does this help?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Jim Glover&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 15:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403979#M98191</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T15:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403992#M98196</link>
      <description>&lt;P&gt;The below code works correctly for me.&amp;nbsp; Unless you can provide your data as a datastep (see my example), then I can only guess.&amp;nbsp; Perhaps there are spaces in there, or special characters, maybe the data isn't like that at all?&lt;/P&gt;
&lt;PRE&gt;data main;
  length host port plugin cve var1-var4 $200;
  input host $ port $ plugin $ cve $ var1 $ var2 $ var3 $ var4 $;
datalines;
10.4.66.182 0 35453 _ OpenN 570461 10/10/17 ESS_WINDOWS
10.4.66.182 445 11457 _ Open 244202 09/15/17 _
10.4.66.182 445 21725 _ Open 244202 9/15/17 ESS_WINDOWS   
10.4.66.182 445 25371 CVE-2007-0328 Open 244204 09/15/17 ESS_WINDOWS   
10.4.66.18 445 27599 CVE-2007-5660 Open 244205 09/15/17 ESS_WINDOWS 
;
run;

data upd;
  length host newvar1 newvar2 newvar3 $200;
  input host $ newvar1 $ newvar2 $ newvar3 $;
datalines;
10.4.66.182 Jimmy Tommy Bobby
;
run;

proc sort data=main;
  by host;
run;

data want;
  merge main (in=a) upd;
  by host;
  if a;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 15:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403992#M98196</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-13T15:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403999#M98200</link>
      <description>Can we talk on the phone, I can setup a Webex to show you what I am doing. Please let me know, and I will provide the info.&lt;BR /&gt;Thanx,&lt;BR /&gt;Jim Glover&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Oct 2017 15:57:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/403999#M98200</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T15:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404007#M98204</link>
      <description>&lt;P&gt;Sounds like you want a left join in SQL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data master;
input host $ port plugin cve;
cards;
abc 1 1 1
abc 1 1 2
abc 1 2 2
aaa 2 3 4
;
run;

data updt;
input host $ newvar1 newvar2 newvar3;
cards;
abc 111 222 333
aaa 111 333 444
;
run;

proc sql;
   create table want as
   select a.*, b.newvar1, b.newvar2, b.newvar3
   from master as a
        left join
        updt as b
        on a.host=b.host
   ;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 16:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404007#M98204</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-13T16:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404016#M98207</link>
      <description>&lt;P&gt;My example has already conclusively proven that the merge works if (and that's of course a big IF) your data is consistent. This is why Maxim 3 is so far up in my list.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 16:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404016#M98207</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-13T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404038#M98214</link>
      <description>&lt;P&gt;I assume that you problem is that you are trying to change values of EXISTING variables in the "master" dataset.&amp;nbsp; If you use a data step MERGE to combine a 1 to Many situation then the "1" record is only read once.&amp;nbsp; So you need to merge on NEW variables from the "1" table if you want the values to be retained onto all of the "many" records from the other table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to update all of the records then just drop the old variables.&amp;nbsp; So if your UPDATES table has just A,VAR1 and VAR2 you could write like this.&amp;nbsp; If there are other variables add them to the drop list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  merge master(drop=var1 var2) updates ;
  by A;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the updates are only for some of the observations in MASTER and you want the others to keep their existing values then you need to work a little harder.&amp;nbsp;&amp;nbsp;Rename the version coming from UPDATES dataset and then conditionally replace the values in the original variable VAR1 with the value from that renamed variable. Drop the extra column(s).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  merge master(in=in1) updates(in=in2 rename=(var1=newvar1 var2=newvar2));
  by A;
  if in2 then do;
    var1=newvar1;
    var2=newvar2;
  end;
  drop newvar1 newvar2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to update in place the you probable can figure out how to do it with MODIFY or you could switch to SQL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
update master
set var1=(select var1 from updates where updates.A=master.A)
  , var2=(select var2 from updates where updates.A=master.A)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404038#M98214</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-13T17:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404055#M98219</link>
      <description>&lt;P&gt;Awesome, Looks like you solution work as I need.&amp;nbsp; Thanx very much for all your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanx again,&lt;/P&gt;
&lt;P&gt;Jim Glover&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404055#M98219</guid>
      <dc:creator>Gloveman71</dc:creator>
      <dc:date>2017-10-13T18:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Update multiple entries in a master file with a single entry from a 2nd file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404386#M98298</link>
      <description>&lt;P&gt;Gosh, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, I should have thought of that. Thumbs Up.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 07:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-multiple-entries-in-a-master-file-with-a-single-entry/m-p/404386#M98298</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-16T07:19:30Z</dc:date>
    </item>
  </channel>
</rss>

