<?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 help on  procsort and merge in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/help-on-procsort-and-merge/m-p/4617#M382</link>
    <description>I am trying to merge three datasets with inequal no of observations. Dataset A has 10 observations, Dataset B has 15 observations and dataset C has 3 observations. The objective of merging is to have a final dataset with a variable present in dataset C and it should have all the variables present in A.&lt;BR /&gt;
&lt;BR /&gt;
Note: There are no common variables in dataset A and C.&lt;BR /&gt;
&lt;BR /&gt;
I first sort dataset A and B with the common variable and merge them using the same common variable. The resultant dataset D is sorted by the same variable as in dataset C and are merged using the common variable.&lt;BR /&gt;
&lt;BR /&gt;
After the merge the final dataset has blank obs in it and also when I am trying to sort the final data set using the same variable. It is giving me an error saying that there is an error in the sorting variable. &lt;BR /&gt;
&lt;BR /&gt;
Please can you let me know what is wrong here?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
APS</description>
    <pubDate>Sun, 09 Sep 2007 20:21:05 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-09-09T20:21:05Z</dc:date>
    <item>
      <title>help on  procsort and merge</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/help-on-procsort-and-merge/m-p/4617#M382</link>
      <description>I am trying to merge three datasets with inequal no of observations. Dataset A has 10 observations, Dataset B has 15 observations and dataset C has 3 observations. The objective of merging is to have a final dataset with a variable present in dataset C and it should have all the variables present in A.&lt;BR /&gt;
&lt;BR /&gt;
Note: There are no common variables in dataset A and C.&lt;BR /&gt;
&lt;BR /&gt;
I first sort dataset A and B with the common variable and merge them using the same common variable. The resultant dataset D is sorted by the same variable as in dataset C and are merged using the common variable.&lt;BR /&gt;
&lt;BR /&gt;
After the merge the final dataset has blank obs in it and also when I am trying to sort the final data set using the same variable. It is giving me an error saying that there is an error in the sorting variable. &lt;BR /&gt;
&lt;BR /&gt;
Please can you let me know what is wrong here?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
APS</description>
      <pubDate>Sun, 09 Sep 2007 20:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/help-on-procsort-and-merge/m-p/4617#M382</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-09T20:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: help on  procsort and merge</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/help-on-procsort-and-merge/m-p/4618#M383</link>
      <description>Have you tried this:&lt;BR /&gt;
&lt;BR /&gt;
data X;&lt;BR /&gt;
   merge D (in=a) C (in=b);&lt;BR /&gt;
   by common_var;&lt;BR /&gt;
   if b;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The "if b" should return only records where C has a record.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I've also found good success with PROC SQL and the LEFT JOIN / RIGHT JOIN / FULL JOIN functionality.  I seem to recall that the way a DATA step and SQL merge is different, so sometimes one might be better suited to your application.</description>
      <pubDate>Mon, 10 Sep 2007 14:11:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/help-on-procsort-and-merge/m-p/4618#M383</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2007-09-10T14:11:12Z</dc:date>
    </item>
  </channel>
</rss>

