<?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: merging in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447554#M112460</link>
    <description>&lt;P&gt;There are a number of possible data combinations that would cause this.&lt;/P&gt;
&lt;P&gt;One is if the ID in the first set has a barcode, is missing id and has not corresponding barcode in the other data.&lt;/P&gt;
&lt;P&gt;Another is if the barcode matches but the second set the matching barcode has missing values for id and trial.&lt;/P&gt;
&lt;P&gt;And also if the second set has barcode that doesn't have a match and is missing id and trial&lt;/P&gt;
&lt;P&gt;Please see this example code:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;data one;
   input barcode id;
datalines;
1234   567
3333   .
6666   123
;
run;

data two;
input barcode id trial;
datalines;
1234 567  8910
5555 888  9999
6666 .    .
7777 .    .
;
run;

data merged;
   merge
      one
      two
   ;
   by barcode ;
run;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suspect that your result is most likely something related to data such as these three cases.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 19:50:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-21T19:50:22Z</dc:date>
    <item>
      <title>merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447521#M112444</link>
      <description>&lt;P&gt;I ran into a strange merge situation and am hoping someone can help me understand it. Here's a simplified version (the real one involved more datasets and more variables):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset ONE, created by Proc Import from an Excel file,&amp;nbsp;contained&amp;nbsp;2 variables: barcode and&amp;nbsp;id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset TWO, created from other SAS datasets, contained 3 variables: BARCODE,&amp;nbsp;ID,&amp;nbsp;and&amp;nbsp;TRIAL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset THREE, created by merging&amp;nbsp;ONE and TWO by&amp;nbsp;barcode (after sorting both datasets by barcode), had all 3 variables, as expected, but data for TRIAL and ID were missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After confirming type, length, label and format of all variables were identical, I changed the case of ONE variables to match TWO variables (i.e., all upper case, rather than all lowercase). I did not change any values, only variable names. When I did this, the merge worked and no values were missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If SAS variable&amp;nbsp;names are case insensitive, how can this be explained?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 18:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447521#M112444</guid>
      <dc:creator>datamgr85</dc:creator>
      <dc:date>2018-03-21T18:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447524#M112445</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If SAS variable&amp;nbsp;names are case insensitive, how can this be explained?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Variable names are case insensitive, but variable values are case sensitive. Also, if you're working with an RBDMS, ie connecting to a SQL server that may be case sensitive.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 18:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447524#M112445</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-21T18:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447525#M112446</link>
      <description>&lt;P&gt;Thanks, Reeza. I didn't change any values, only variable names.&amp;nbsp;I&amp;nbsp;will look into whether a SQL server could be the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 18:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447525#M112446</guid>
      <dc:creator>datamgr85</dc:creator>
      <dc:date>2018-03-21T18:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447554#M112460</link>
      <description>&lt;P&gt;There are a number of possible data combinations that would cause this.&lt;/P&gt;
&lt;P&gt;One is if the ID in the first set has a barcode, is missing id and has not corresponding barcode in the other data.&lt;/P&gt;
&lt;P&gt;Another is if the barcode matches but the second set the matching barcode has missing values for id and trial.&lt;/P&gt;
&lt;P&gt;And also if the second set has barcode that doesn't have a match and is missing id and trial&lt;/P&gt;
&lt;P&gt;Please see this example code:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;data one;
   input barcode id;
datalines;
1234   567
3333   .
6666   123
;
run;

data two;
input barcode id trial;
datalines;
1234 567  8910
5555 888  9999
6666 .    .
7777 .    .
;
run;

data merged;
   merge
      one
      two
   ;
   by barcode ;
run;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suspect that your result is most likely something related to data such as these three cases.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 19:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging/m-p/447554#M112460</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-21T19:50:22Z</dc:date>
    </item>
  </channel>
</rss>

