<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91825#M19381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a ton&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2012 19:25:57 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2012-12-06T19:25:57Z</dc:date>
    <item>
      <title>Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91818#M19374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables as shown below.&lt;STRONG&gt; pr_id&lt;/STRONG&gt; has orders placed as well as orders completed on a patient. Our aim is to get the orders completed on a patient&lt;/P&gt;&lt;P&gt;In the second &lt;STRONG&gt;int_table&lt;/STRONG&gt; , &lt;STRONG&gt;or_id&lt;/STRONG&gt; has the placed orders and&lt;STRONG&gt; int_id&lt;/STRONG&gt; has completed orders.&lt;/P&gt;&lt;P&gt;i want to pull only the completed orders from proc table????&lt;/P&gt;&lt;P&gt;pat A represents same pateint but int_table has no patient info&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;proc table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pr_id&amp;nbsp;&amp;nbsp;&amp;nbsp; pat&amp;nbsp;&amp;nbsp; descrip&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;int_table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or_id&amp;nbsp;&amp;nbsp;&amp;nbsp; int_id&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Dec 2012 23:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91818#M19374</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-05T23:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91819#M19375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to show an example of what your output should look like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Dec 2012 23:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91819#M19375</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-12-05T23:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91820#M19376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you have to use conditional statement at some point with merge / proc SQL join but still if you will provide complete information then i can answer correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 16:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91820#M19376</guid>
      <dc:creator>Ranny</dc:creator>
      <dc:date>2012-12-06T16:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91821#M19377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a straightforward SORT and MERGE, as long as the order numbers are never re-used.&amp;nbsp; If the same order number could be used for more than one patient, there is not enough information in the data to solve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=proc_table;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by prd_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=int_table (keep=int_id) out=completed (rename=(int_id=pr_id));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by pr_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data completed;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; merge proc_table (in=in1) completed (in=in2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by pr_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if in1 and in2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 17:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91821#M19377</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-12-06T17:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91822#M19378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WOWWWWWW&lt;/P&gt;&lt;P&gt;I think your method is pretty straightforward.&lt;/P&gt;&lt;P&gt;i was confused and used this lengthy confusing procedure.Could you also confirm if the method i was trying to use will also produce the same result????&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I applied a CNTLIN format on proc table for pr_id after renaming pr_id to or_id&lt;/P&gt;&lt;P&gt;I then ued that format on int_table for or_id variable....&amp;nbsp;&amp;nbsp;&amp;nbsp; where put(or_id,format.)="true";&lt;/P&gt;&lt;P&gt;Then from the resulting dataset i wrote a format CNTLIN for&amp;nbsp; int_id and APPLIED IT BACK TO THE PROC TABLE....&lt;/P&gt;&lt;P&gt;set proc table&lt;/P&gt;&lt;P&gt;where put(pr_id,format.="true";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 18:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91822#M19378</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-06T18:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91823#M19379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without seeing the code I can't say if your exact approach would work. You would need the where as a separate statement not a dataset option since you are using a function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set proc_table;&lt;/P&gt;&lt;P&gt;where put(pr_id,format.)='true';&lt;/P&gt;&lt;P&gt;should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 18:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91823#M19379</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-12-06T18:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91824#M19380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you jumped throuigh a few extra hoops.&amp;nbsp; The first half of your program would not be needed.&amp;nbsp; It would be enough to create the format based on the original INT_TABLE, then apply it to PROC_TABLE.&amp;nbsp; It would not impact the results if the format contains a few extra entries that are not found in PROC_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The methods you used are a standard form of look-up in SAS.&amp;nbsp; Even if they would not be best for this particular problem (and that is a matter for debate), they are still tools that you should know.&amp;nbsp; So is SORT and MERGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To tell if the two methods produce identical results, you should test it.&amp;nbsp; That means (1) take the results of your CNTLIN approach, and sort it by PR_ID, then (2) run a PROC COMPARE to search for differences between the two output data sets.&amp;nbsp; Before doing that, check the logs from both approaches and see if the output data sets contain the same number of observations.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 18:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91824#M19380</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-12-06T18:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91825#M19381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a ton&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 19:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91825#M19381</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-06T19:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91826#M19382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you dont mind i have a question????&lt;/P&gt;&lt;P&gt;to your post " It would not impact the results if the format contains a few extra entries that are not found in PROC_TABLE."&lt;/P&gt;&lt;P&gt;the reason i am using a format of the&lt;STRONG&gt; proc table&lt;/STRONG&gt; because this&amp;nbsp; (contains my cohort for the period of interst).&lt;/P&gt;&lt;P&gt;i am worried if i dint do that......i would be picking 150k extra records(all the orders in the database ....ie which are not concerned with the patients i want........Do u think it is OK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 19:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91826#M19382</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-06T19:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91827#M19383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like it should be fine either way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If PROC_TABLE contains just the cohort you want to examine, it wouldn't match any of the 150k extra records.&amp;nbsp; So the results should be the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 19:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91827#M19383</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-12-06T19:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91828#M19384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnxxxx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 19:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91828#M19384</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-06T19:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91829#M19385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;This code&lt;/P&gt;&lt;P&gt;proc sort data=int_table (keep=int_id) out=completed (rename=(int_id=pr_id));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by pr_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess we cant sort it by pr_id.......Is there any other way to rectify this error????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing i think of is to use&lt;/P&gt;&lt;P&gt;by int_id&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;will that solve the purpose????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also these names cannot be the same right???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &lt;STRONG&gt;completed&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; merge proc_table (in=in1) &lt;STRONG&gt;completed&lt;/STRONG&gt; (in=in2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by pr_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if in1 and in2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 04:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge/m-p/91829#M19385</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-07T04:58:27Z</dc:date>
    </item>
  </channel>
</rss>

