<?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 two sets with multiple observations in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745348#M29353</link>
    <description>&lt;P&gt;You may want to go back to the step(s) that brought the data into SAS.&lt;/P&gt;
&lt;P&gt;You AdmissionID variable has an informat of $10 in the Dadmerge4 data set and $11 in the Combine6 data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That makes one suspect that perhaps a number of values in the Dadmerge4 set were truncated when read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Large economy size hint: If you are using Proc Import and the source data is a spreadsheet then you need to &lt;STRONG&gt;very carefully &lt;/STRONG&gt;examine the properties of variables as a very few rows of the data used in general to set the length and type.&lt;/P&gt;
&lt;P&gt;If this sounds to be a plausible source of your data differences then you might consider 1) save the spreadsheets to a CSV file format, then if you use Proc Import you can add the Guessingrows=max; or some largish number , so more rows of data are used to set the properties. Better would be to write a data step to read the data where you control all the properties&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 22:21:33 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-06-02T22:21:33Z</dc:date>
    <item>
      <title>Merging two sets with multiple observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745341#M29352</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to merge two datasets based on a character variable 'AdmissionID.' I am looking for a left join. I've tried the following code (see below), however only very few observations from the table DADmerge3 merge (despite seemingly apparent AdmissionIDs). I've read through multiple SAS help forums, tried to harmonize the AdmissionID variables etc, and no luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried:&lt;/P&gt;
&lt;P&gt;proc sort data=export.combine6;&lt;/P&gt;
&lt;P&gt;by AdmissionID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=export.DADmerge4;&lt;/P&gt;
&lt;P&gt;by AdmissionID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data mergeDADCR;&lt;BR /&gt;merge export.combine6 (in=CR) export.DADmerge4 (in=DAD);&lt;BR /&gt;by admissionID;&lt;BR /&gt;if CR then export;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of how I would like the data to merge:&lt;/P&gt;
&lt;P&gt;Combine 6:&lt;/P&gt;
&lt;P&gt;AdmissionID&amp;nbsp; &amp;nbsp;RBC&amp;nbsp; &amp;nbsp; WBC&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DADmerge4:&lt;/P&gt;
&lt;P&gt;AdmissionID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Transfusion&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Num&lt;/P&gt;
&lt;P&gt;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; &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; 8&lt;/P&gt;
&lt;P&gt;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; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3&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; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Merged set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;AdmissionID&amp;nbsp; &amp;nbsp; &amp;nbsp;RBC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WBC&amp;nbsp; &amp;nbsp; Transfusion&amp;nbsp; &amp;nbsp; Num&lt;/P&gt;
&lt;P&gt;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; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&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;8&lt;/P&gt;
&lt;P&gt;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; &amp;nbsp;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&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;8&lt;/P&gt;
&lt;P&gt;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; &amp;nbsp;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be very appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Brett&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 21:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745341#M29352</guid>
      <dc:creator>bretthouston</dc:creator>
      <dc:date>2021-06-02T21:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two sets with multiple observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745348#M29353</link>
      <description>&lt;P&gt;You may want to go back to the step(s) that brought the data into SAS.&lt;/P&gt;
&lt;P&gt;You AdmissionID variable has an informat of $10 in the Dadmerge4 data set and $11 in the Combine6 data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That makes one suspect that perhaps a number of values in the Dadmerge4 set were truncated when read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Large economy size hint: If you are using Proc Import and the source data is a spreadsheet then you need to &lt;STRONG&gt;very carefully &lt;/STRONG&gt;examine the properties of variables as a very few rows of the data used in general to set the length and type.&lt;/P&gt;
&lt;P&gt;If this sounds to be a plausible source of your data differences then you might consider 1) save the spreadsheets to a CSV file format, then if you use Proc Import you can add the Guessingrows=max; or some largish number , so more rows of data are used to set the properties. Better would be to write a data step to read the data where you control all the properties&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 22:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745348#M29353</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-02T22:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two sets with multiple observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745364#M29355</link>
      <description>&lt;P&gt;Thanks for this reply, I really appreciate it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have re-imported as suggested, but that doesn't seem to make a difference. Many of the admissionIDs (linking variable) are seemingly identical between the two tables (with the same number of digits; no truncation) and yet the data from table 2 is only populated in 185/1390 rows (when I would expect nearly all of the admissionIDs in table 1 to have a match in table 2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I misunderstood your solution though, please let me know as it's entirely possible!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 00:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745364#M29355</guid>
      <dc:creator>bretthouston</dc:creator>
      <dc:date>2021-06-03T00:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two sets with multiple observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745370#M29356</link>
      <description>&lt;P&gt;Please don't say Table1 and Table2. You haven't indicated which would be which.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you &lt;STRONG&gt;believe&lt;/STRONG&gt; that "most" of the ids in one data set would be in the other?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 00:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-two-sets-with-multiple-observations/m-p/745370#M29356</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-03T00:57:03Z</dc:date>
    </item>
  </channel>
</rss>

