<?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: one-to-many match in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628036#M20630</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2020 20:18:19 GMT</pubDate>
    <dc:creator>dapenDaniel</dc:creator>
    <dc:date>2020-02-27T20:18:19Z</dc:date>
    <item>
      <title>one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628030#M20626</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets as below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input ID $ Var1;
datalines;
AA 0
AA 0 
BB 0  
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
input ID $ Var1;
datalines;
AA 1
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to replace all id=AA in have1 with the value of id=AA in have2. The expected results are below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Var1&lt;/P&gt;&lt;P&gt;AA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;AA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;BB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following program but it can only replace the value of first AA with 1 and that of the second one is still 0&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have1 out=have11;
by classD;
run;

proc sort data=have2 out=have21;
by classD;
run;

data merged;
merge have11 (in=q) have21;
by id;
if q;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can I get the expected results? Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628030#M20626</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-27T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628034#M20628</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have1 out=have11;
by id;
run;

proc sort data=have2 out=have21;
by id;
run;

data merged;
merge have11(in=q) have21(in=z);
by id;
if q;
var1=z;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628034#M20628</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-27T20:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628036#M20630</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628036#M20630</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-27T20:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628037#M20631</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;actually, I have 335 variables after Id and their name is Col2, Col3,...Col336. How can I let SAS know that I would like to keep the value of id=AA in have2? Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628037#M20631</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-27T20:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628039#M20632</link>
      <description>&lt;P&gt;Well your right table i.e the variable names in table name specified on the right will overwrite the values in the left if the names the the same. Is this your concern?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, test for like 10-15 vars manually and then you are ought to be more confident&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628039#M20632</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-27T20:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628042#M20633</link>
      <description>&lt;P&gt;Sorry, I did not put it in a clear way. I mean there are 335 variables called Var1, Var2,...Var336 after Id. I have added 5 variables manually and it works (code is below). I am wondering whether there is a way that I can tell SAS to overwrite the value for all these 335 variables, like Var2-Var336=z (I tried it but it did not work).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data merged;
merge have11 (in=q) have21 (in=z);
by id;
if q;
Var58=z;
Var65=z;
Var88=z;
Var144=z;
Var203=z;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628042#M20633</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-27T20:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628043#M20634</link>
      <description>&lt;P&gt;Ah ok, So are the Vars consecutive in sequence?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If yes,&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;array t Var2-Var336; grouping can work&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data merged;
merge have11 (in=q) have21 (in=z);
by id;
if q;
array t Var2-Var336;
do over t;
 t=z;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628043#M20634</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-27T20:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: one-to-many match</title>
      <link>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628664#M20673</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 06:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/one-to-many-match/m-p/628664#M20673</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-03-02T06:18:11Z</dc:date>
    </item>
  </channel>
</rss>

