<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499634#M132983</link>
    <description>&lt;P&gt;data work.BREAST_DIAG_PRTY1;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='A_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='B_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='C_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_One='A_222';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_One='B_222';&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data work.ICD10_CLASSIFICATIONS;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_Two='X_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_Two='Y_222';&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data = work.BREAST_DIAG_PRTY1; By DIAG_CD; run;&lt;/P&gt;
&lt;P&gt;proc sort data = work.BREAST_DIAG_PRTY1; By DIAG_CD; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.BREAST_ED_REASONS_GS_092718;&lt;BR /&gt;MERGE work.BREAST_DIAG_PRTY1 work.ICD10_CLASSIFICATIONS;&lt;BR /&gt;by DIAG_CD;&lt;BR /&gt;RUN;&lt;BR /&gt;proc print; run;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Sep 2018 18:07:42 GMT</pubDate>
    <dc:creator>VenuKadari</dc:creator>
    <dc:date>2018-09-27T18:07:42Z</dc:date>
    <item>
      <title>Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499596#M132968</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge 2 datasets based on diagnosis code. I have 1 table with many diagnosis codes repeated and then another table that has the individual diagnosis codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data BREAST_ED_REASONS_GS_092718;&lt;BR /&gt;MERGE raw.BREAST_DIAG_PRTY1 raw.ICD10_CLASSIFICATIONS;&lt;BR /&gt;WHERE BREAST_DIAG_PRTY1.DIAG_CD=ICD10_CLASSIFICATIONS.DIAG_CD;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code I have 344 unique codes that merge over to the original dataset, however I need it to match to 1500 codes. Any help would be appreciated! Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 16:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499596#M132968</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-09-27T16:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499617#M132977</link>
      <description>&lt;P&gt;I guess you meant&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BREAST_ED_REASONS_GS_092718;
MERGE raw.BREAST_DIAG_PRTY1 raw.ICD10_CLASSIFICATIONS;
BY DIAG_CD;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Sep 2018 17:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499617#M132977</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-09-27T17:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499618#M132978</link>
      <description>&lt;P&gt;Just by looking at your code, I am assuming you have some experience in SQL? It looks like you are trying to use the WHERE statement like you would in SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS the MERGE statement needs the BY Statement. The by statement will tell SAS what columns to merge on. The column that you are merging on must have the same name in both tables (which yours looks like it does) and be sorted in both tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without really understanding the data and your goal,I can only get you started. Your code should look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BREAST_ED_REASONS_GS_092718;
MERGE raw.BREAST_DIAG_PRTY1 raw.ICD10_CLASSIFICATIONS;
BY DIAG_CD;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here is some documentation for you to look at:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;SAS Paper: &lt;A href="https://www.lexjansen.com/nesug/nesug11/ds/ds03.pdf" target="_self"&gt;SAS® DATA Step Merge – A Powerful Tool&lt;/A&gt;&amp;nbsp;(this is pretty in depth and should really help).&lt;/LI&gt;
&lt;LI&gt;SAS Documentation: &lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001318494.htm" target="_self"&gt;Match-Merging&lt;/A&gt;&amp;nbsp;(quick examples)&lt;/LI&gt;
&lt;LI&gt;SAS Documentation: &lt;A href="http://support.sas.com/documentation/cdl//en/sqlproc/69822/HTML/default/viewer.htm#p1bk7i6jqseje7n1lifcip8kzhpp.htm" target="_self"&gt;SAS® 9.4 SQL Procedure User's Guide, Fourth Edition - Joins&lt;/A&gt;&amp;nbsp;(Using PROC SQL)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 17:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499618#M132978</guid>
      <dc:creator>Panagiotis</dc:creator>
      <dc:date>2018-09-27T17:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499634#M132983</link>
      <description>&lt;P&gt;data work.BREAST_DIAG_PRTY1;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='A_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='B_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_One='C_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_One='A_222';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_One='B_222';&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data work.ICD10_CLASSIFICATIONS;&lt;BR /&gt;DIAG_CD=111;&lt;BR /&gt;Field_Two='X_111';&lt;BR /&gt;output;&lt;BR /&gt;DIAG_CD=222;&lt;BR /&gt;Field_Two='Y_222';&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data = work.BREAST_DIAG_PRTY1; By DIAG_CD; run;&lt;/P&gt;
&lt;P&gt;proc sort data = work.BREAST_DIAG_PRTY1; By DIAG_CD; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.BREAST_ED_REASONS_GS_092718;&lt;BR /&gt;MERGE work.BREAST_DIAG_PRTY1 work.ICD10_CLASSIFICATIONS;&lt;BR /&gt;by DIAG_CD;&lt;BR /&gt;RUN;&lt;BR /&gt;proc print; run;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 18:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/499634#M132983</guid>
      <dc:creator>VenuKadari</dc:creator>
      <dc:date>2018-09-27T18:07:42Z</dc:date>
    </item>
  </channel>
</rss>

