<?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: Match Merging Unnecessarily Creating new Rows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577737#M75535</link>
    <description>&lt;P&gt;Indeed. Brand the scarlet letter on me and let me face my public humiliation.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2019 13:51:28 GMT</pubDate>
    <dc:creator>joebacon</dc:creator>
    <dc:date>2019-07-30T13:51:28Z</dc:date>
    <item>
      <title>Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577726#M75529</link>
      <description>&lt;P&gt;Hi again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems like a VERY easy fix that I can't seem to get down. As the title states, I am trying to merge based on an ID variable (PID). When I go to merge the two datasets, it creates new rows even when the PID matches in both datasets. The new dataset puts all of one dataset's variables into a new row and makes the other dataset's variables missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data= sub.aptcorrelations;
by pid;
proc sort data= sub.master_dataset053019;
by pid;
data Merged;
set   sub.aptcorrelations sub.master_dataset053019;
by pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I checked the variables and both PID variables are numeric and 8 in length. They do have different labels which may matter, but I do not think that it does.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing the order of the datasets and using an inner join. What could I possibly be missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached a picture for clarity. I am trying to get everything on one row and matched by PID.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MergeIssue.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31412iA9959FE28250F650/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MergeIssue.PNG" alt="MergeIssue.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the merge log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='S:\Alcstudy\ComboDataEntry\Joe\Inflation\Subcategories\MasterDataset and RegressionLogProp1.egp'
5        ! ;
6          %LET _CLIENTPROJECTNAME='MasterDataset and RegressionLogProp1.egp';
7          %LET _SASPROGRAMFILE=;
8          
9          ODS _ALL_ CLOSE;
10         OPTIONS DEV=ACTIVEX;
11         GOPTIONS XPIXELS=0 YPIXELS=0;
12         FILENAME EGSR TEMP;
13         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
14             STYLE=HtmlBlue
15             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
16             NOGTITLE
17             NOGFOOTNOTE
18             GPATH=&amp;amp;sasworklocation
19             ENCODING=UTF8
20             options(rolap="on")
21         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
22         
23         GOPTIONS ACCESSIBLE;
24         data Merged;
25         set   sub.aptcorrelations sub.master_dataset053019;
26         by pid;
27         run;

NOTE: There were 191 observations read from the data set SUB.APTCORRELATIONS.
NOTE: There were 616 observations read from the data set SUB.MASTER_DATASET053019.
NOTE: The data set WORK.MERGED has 807 observations and 7692 variables.
NOTE: DATA statement used (Total process time):
      real time           0.66 seconds
      cpu time            0.14 seconds
     &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MergeIssue.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31411i275F6C2751EE9837/image-size/large?v=v2&amp;amp;px=999" role="button" title="MergeIssue.PNG" alt="MergeIssue.PNG" /&gt;&lt;/span&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577726#M75529</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-07-30T13:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577728#M75530</link>
      <description>&lt;P&gt;You have one-to-many relationships for some of the pid values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Corrected: looks like you may have no matches at all, as the obs count of the output is the sum of the obscounts of the inputs.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577728#M75530</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-30T13:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577731#M75531</link>
      <description>&lt;P&gt;Are you trying to interleave(sorted append) or merge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If match merge is really your objective, the code should be using a &lt;STRONG&gt;merge&lt;/STRONG&gt; statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Merged;
merge   sub.aptcorrelations sub.master_dataset053019;
by pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577731#M75531</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-30T13:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577732#M75532</link>
      <description>&lt;P&gt;I am an absolute moron. Thank you. I looked in every single place except the most obvious one. Wow.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577732#M75532</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-07-30T13:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577734#M75533</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Are you trying to interleave(sorted append) or merge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If match merge is really your objective, the code should be using a &lt;STRONG&gt;merge&lt;/STRONG&gt; statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Merged;
merge   sub.aptcorrelations sub.master_dataset053019;
by pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Gosh. Well, it's been the end of a working day ....&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577734#M75533</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-30T13:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577736#M75534</link>
      <description>&lt;P&gt;lol Well it's 9:51 AM here and am fresh although got a sinus headache that's annoying but coffee helps . Have a great afternoon&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577736#M75534</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-30T13:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Match Merging Unnecessarily Creating new Rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577737#M75535</link>
      <description>&lt;P&gt;Indeed. Brand the scarlet letter on me and let me face my public humiliation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 13:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Match-Merging-Unnecessarily-Creating-new-Rows/m-p/577737#M75535</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-07-30T13:51:28Z</dc:date>
    </item>
  </channel>
</rss>

