<?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: Please help with merge step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18567#M2807</link>
    <description>From what you have explained, it appears as though you do not actually have a common SAS variable to use with the MERGE/BY processing.&lt;BR /&gt;
&lt;BR /&gt;
You need to investigate your input data files for differences for your MERGE/BY variable(s).&lt;BR /&gt;
&lt;BR /&gt;
And, you can add this SAS statement to help diagnose the IN= variable when doing the MERGE -- though, again, it will not solve any problem.&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
Possibly using PROC FREQ may help analyze your input file(s), as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Mon, 28 Feb 2011 21:54:44 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2011-02-28T21:54:44Z</dc:date>
    <item>
      <title>Please help with merge step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18566#M2806</link>
      <description>There are two data sets  - Member  and Sorted&lt;BR /&gt;
&lt;BR /&gt;
for all records in data set b (variables different from data set a, but there is one mrgvar  )  , I need to catenate matching record info from data set a  on that merge variable. &lt;BR /&gt;
&lt;BR /&gt;
Below logic is not writing out any of info -&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA Merged; &lt;BR /&gt;
  MERGE   MEMBER(in=a) sorted(in=b); &lt;BR /&gt;
  BY MRGVAR1 ; &lt;BR /&gt;
  if a and b ; &lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Also  this below is writing only info from data set b , but not from data set a.&lt;BR /&gt;
&lt;BR /&gt;
DATA Merged; &lt;BR /&gt;
  MERGE   MEMBER(in=a) sorted(in=b); &lt;BR /&gt;
  BY MRGVAR1 ; &lt;BR /&gt;
  if b ; &lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
How to accomplish all member info catenated with sorted info for a matching merge variable.&lt;BR /&gt;
&lt;BR /&gt;
thanks,&lt;BR /&gt;
ls</description>
      <pubDate>Mon, 28 Feb 2011 17:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18566#M2806</guid>
      <dc:creator>sasbasls</dc:creator>
      <dc:date>2011-02-28T17:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with merge step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18567#M2807</link>
      <description>From what you have explained, it appears as though you do not actually have a common SAS variable to use with the MERGE/BY processing.&lt;BR /&gt;
&lt;BR /&gt;
You need to investigate your input data files for differences for your MERGE/BY variable(s).&lt;BR /&gt;
&lt;BR /&gt;
And, you can add this SAS statement to help diagnose the IN= variable when doing the MERGE -- though, again, it will not solve any problem.&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
Possibly using PROC FREQ may help analyze your input file(s), as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 28 Feb 2011 21:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18567#M2807</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-02-28T21:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with merge step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18568#M2808</link>
      <description>Hello SASBasis,&lt;BR /&gt;
&lt;BR /&gt;
It seems to me that you need proc SQL:&lt;BR /&gt;
[pre]proc SQL;&lt;BR /&gt;
  create table Merged as&lt;BR /&gt;
  select a.*, b.*&lt;BR /&gt;
  from Member as a left join Sorted as b&lt;BR /&gt;
  where a.MRGVAR1=b.MRGVAR1&lt;BR /&gt;
;quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The only thing I'd like to note. Instead of my b.* it is better to list all necessary fields from Sorted (e.g. if Sorted contains fields MRGVAR1, A, B, etc. then it should be b.A, b.B etc. MRGVAR1 it is not necessary to list).&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Thu, 03 Mar 2011 19:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-merge-step/m-p/18568#M2808</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-03T19:16:15Z</dc:date>
    </item>
  </channel>
</rss>

