<?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: Merge Multiple records per subject in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472245#M121058</link>
    <description>&lt;P&gt;Yes, which data set (besides the one that you know about) contains multiple records per SUBJECT.&amp;nbsp; Since your PROC SORTs all use a temporary copy of the original data, you could just add NODUPKEY to each PROC SORT.&amp;nbsp; The log will identify how many observations get removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you find out where the problem is, you need to decide what to do, to correct the data.&amp;nbsp; It's mostly a decision, not a programming problem.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jun 2018 18:52:00 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-06-21T18:52:00Z</dc:date>
    <item>
      <title>Merge Multiple records per subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472228#M121045</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can some one help me to get rid of this note. "NOTE: MERGE statement has more than one data set with repeats of BY values."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The following is the part of the code that is being written merging the following data sets with varied number of observations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data abc_;&lt;BR /&gt;set abc;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=abc_;&lt;BR /&gt;by SUBJECT;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data efg_;&lt;BR /&gt;set efg;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=efg_;&lt;BR /&gt;by SUBJECT;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data xyz_;&lt;BR /&gt;set xyz;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=xyz_;&lt;BR /&gt;by SUBJECT;&lt;BR /&gt;&lt;BR /&gt;proc sort data=der3_;&lt;BR /&gt;by SUBJECT;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data der4;&lt;BR /&gt;merge der3_ (in=a) abc_ (in=b) efg_ (in=c) xyz_ (in=d);&lt;BR /&gt;by SUBJECT;&lt;BR /&gt;if c;;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LOG:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 83 observations read from the data set WORK.DER3_.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 180 observations read from the data set WORK.ABC_.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 728 observations read from the data set WORK.EFG_.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 89 observations read from the data set WORK.XYZ_.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.DER4 has 728 observations and 35 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;As a note, work.abc_ data set has multiple records per subject, as test results are recorded starting from Day 0- Day7, therefore each subject has 8 records.&amp;nbsp;SUBJECT is the unique ID for all the data sets. How to handle the multiple records when merging? Any suggestion is highly appreciated.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Thank you,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Regards,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Nasya&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Jun 2018 18:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472228#M121045</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-21T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Multiple records per subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472236#M121050</link>
      <description>&lt;P&gt;The note is telling you that either:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1) You're wrong and one of the other data sets contains multiple records for a SUBJECT.&amp;nbsp; (You would have to locate where that happens.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) SUBJECT is a character variable with different lengths across the data sets.&amp;nbsp; There are easy fixes if you know that this is the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 18:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472236#M121050</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-21T18:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Multiple records per subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472242#M121055</link>
      <description>#2 is not the issue but can be #1.&lt;BR /&gt;When you say, locate where it happens, do you mean the data set which has the multiple records or the variable?</description>
      <pubDate>Thu, 21 Jun 2018 18:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472242#M121055</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-21T18:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Multiple records per subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472245#M121058</link>
      <description>&lt;P&gt;Yes, which data set (besides the one that you know about) contains multiple records per SUBJECT.&amp;nbsp; Since your PROC SORTs all use a temporary copy of the original data, you could just add NODUPKEY to each PROC SORT.&amp;nbsp; The log will identify how many observations get removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you find out where the problem is, you need to decide what to do, to correct the data.&amp;nbsp; It's mostly a decision, not a programming problem.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 18:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Multiple-records-per-subject/m-p/472245#M121058</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-21T18:52:00Z</dc:date>
    </item>
  </channel>
</rss>

