<?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: How do I avoid the Merge warning for repeat values in a data set with this problem? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844206#M333759</link>
    <description>&lt;P&gt;If both dataset have duplicate observations for some SUBJID and PARAM value then what would merging them even mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you just want to interleave the observations instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set main have;
  by subjid param;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 14 Nov 2022 20:50:58 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-11-14T20:50:58Z</dc:date>
    <item>
      <title>How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844193#M333749</link>
      <description>&lt;P&gt;Hi, I'm having log message pop up that says that one of my data sets im trying to merge has repeat values.&lt;/P&gt;
&lt;P&gt;I'm trying to pull specific subjid/param combos (in the Have data set below) from the main data set that i'm trying to explore, and the message pops up. I would like to avoid this message.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;  * unique subjid/param combos list;
infile datalines dsd dlm=",";
	input subjid $ param $;
datalines;
001, red
002, orange
002, yellow
002, green
003, indigo
003, purple
;
run;
proc sort; by subjid, param; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data main; * main data set i'm trying to explore;
infile datalines dsd dlm=",";
	input subjid $ param $ visit $ value;
datalines;
001, red, first, 2
001, orange, first, 2
001, yellow, first, 2
001, yellow, second, 3
002, yellow, first, 4
002, green, second, 4
002, green, third, 5
002, indigo, first, 1
003, red, second, 2
003, blue, first, 2
003, indigo, first, 3
003, indigo, second, 4
003, indigo, third, 4
003, purple, first, 5
003, purple, fifth, 5
;
run;
proc sort; by subjid param; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;desired output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hello_there_0-1668455036805.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77292iD6F7DDA4D5CD9E43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hello_there_0-1668455036805.png" alt="Hello_there_0-1668455036805.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 19:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844193#M333749</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T19:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844195#M333750</link>
      <description>&lt;P&gt;Can you show the MERGE code you tried?&amp;nbsp; Are you merging BY SubjID Param?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 19:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844195#M333750</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-14T19:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844196#M333751</link>
      <description>Hi Quentin, I have my merged code on another computer, and the real MAIN data sets includes almost 40 variables that i'm trying to include.&lt;BR /&gt;So to picture, the MAIN data set has multiple values of the combination of SUBJID and PARAM because there are multiple visits. But i'm hoping to grab all those rows that include every visit.&lt;BR /&gt;&lt;BR /&gt;Yes, i am merging by SUBJID PARAM. &lt;BR /&gt;</description>
      <pubDate>Mon, 14 Nov 2022 19:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844196#M333751</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T19:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844197#M333752</link>
      <description>&lt;P&gt;The code you posted is not going to generate such a message.&lt;/P&gt;
&lt;P&gt;What code did you try that generated the message?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you merge the data you have you won't get that message either since the BY variables uniquely identify the data the HAVE dataset.&lt;/P&gt;
&lt;PRE&gt;473  data want;
474    merge have(in=in1) main(in=in2);
475    by subjid param;
476    in_have=in1;
477    in_main=in2;
478  run;

NOTE: There were 6 observations read from the data set WORK.HAVE.
NOTE: There were 15 observations read from the data set WORK.MAIN.
NOTE: The data set WORK.WANT has 16 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;PRE&gt;Obs    subjid    param     visit     value    in_have    in_main

  1     001      orange    first       2         0          1
  2     001      red       first       2         1          1
  3     001      yellow    first       2         0          1
  4     001      yellow    second      3         0          1
  5     002      green     second      4         1          1
  6     002      green     third       5         1          1
  7     002      indigo    first       1         0          1
  8     002      orange                .         1          0
  9     002      yellow    first       4         1          1
 10     003      blue      first       2         0          1
 11     003      indigo    first       3         1          1
 12     003      indigo    second      4         1          1
 13     003      indigo    third       4         1          1
 14     003      purple    first       5         1          1
 15     003      purple    fifth       5         1          1
 16     003      red       second      2         0          1
&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Nov 2022 19:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844197#M333752</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-14T19:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844198#M333753</link>
      <description>Hi Tom,&lt;BR /&gt;I did it this way, except i called them "a" and "b" respectively, and said if "a" and "b"</description>
      <pubDate>Mon, 14 Nov 2022 20:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844198#M333753</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T20:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844199#M333754</link>
      <description>I'm wondering if i could avoid the message by using PROC sql instead, but i'm not too familiar w/ PROC SQL.</description>
      <pubDate>Mon, 14 Nov 2022 20:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844199#M333754</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T20:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844203#M333756</link>
      <description>After double checking my code, i noticed that one of the input data sets had multiple instances of the same combination of subjid/param. Once i sorted w/ the nodup option, it eliminated any repeats, and the merge worked.&lt;BR /&gt;&lt;BR /&gt;Thanks for helping!</description>
      <pubDate>Mon, 14 Nov 2022 20:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844203#M333756</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T20:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844206#M333759</link>
      <description>&lt;P&gt;If both dataset have duplicate observations for some SUBJID and PARAM value then what would merging them even mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you just want to interleave the observations instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set main have;
  by subjid param;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Nov 2022 20:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844206#M333759</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-14T20:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid the Merge warning for repeat values in a data set with this problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844214#M333762</link>
      <description>What had happened was I forgot to delete duplicate observations in the data set that included only subjid and param in my real work (not the example in this thread). &lt;BR /&gt;&lt;BR /&gt;Once I did, your code worked for me. &lt;BR /&gt;&lt;BR /&gt;Thanks again!</description>
      <pubDate>Mon, 14 Nov 2022 21:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-the-Merge-warning-for-repeat-values-in-a-data-set/m-p/844214#M333762</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-11-14T21:35:08Z</dc:date>
    </item>
  </channel>
</rss>

