<?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 with index in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455576#M115263</link>
    <description>sorry,&lt;BR /&gt;here base table is A table and A table is B table</description>
    <pubDate>Thu, 19 Apr 2018 12:45:37 GMT</pubDate>
    <dc:creator>sathya66</dc:creator>
    <dc:date>2018-04-19T12:45:37Z</dc:date>
    <item>
      <title>merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455551#M115248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to merge with index variables&amp;nbsp; but when merge finished the output table doesn't have the index table.&lt;/P&gt;&lt;P&gt;here&amp;nbsp; my&amp;nbsp;A &amp;nbsp;table has index variables . I want see the same result in&amp;nbsp;TEST table &amp;nbsp;also(with index variables).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;data test;

merge a(in=a) b(in=b);

by id;

if a=b then do;

if name ne ' ' then name='XXXX';

end;

if a then output;

run;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455551#M115248</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-19T12:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455567#M115257</link>
      <description>&lt;P&gt;If you want to have an index for a newly created dataset, use proc datasets to add it to the dataset. Indexes are not automatically created.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455567#M115257</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-19T12:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455568#M115258</link>
      <description>&lt;P&gt;Post test data in the form of a datastep and what the output should look like.&amp;nbsp; At a guess:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;if a=b then do;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Does not do what you think it does, you may mean, if a and b, i.e. if record is in both datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't really tell you anything else without seeing some data.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455568#M115258</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-19T12:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455570#M115260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Post test data in the form of a datastep and what the output should look like.&amp;nbsp; At a guess:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;if a=b then do;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Does not do what you think it does, you may mean, if a and b, i.e. if record is in both datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't really tell you anything else without seeing some data.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The funny thing is that this works, as a = b = 0 can never happen. Although I prefer to use &lt;FONT face="courier new,courier"&gt;if a and b&lt;/FONT&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455570#M115260</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-19T12:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455574#M115262</link>
      <description>&lt;P&gt;yes It is working , but I will change to if a and b. here Id is the index varable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455574#M115262</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-19T12:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455576#M115263</link>
      <description>sorry,&lt;BR /&gt;here base table is A table and A table is B table</description>
      <pubDate>Thu, 19 Apr 2018 12:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455576#M115263</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-19T12:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455578#M115264</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455578#M115264</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-19T12:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455579#M115265</link>
      <description>&lt;P&gt;Running this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
merge sascomm.base(in=a) sascomm.a(in=b);
by id;
if a=b then do;
  if name ne ' ' then name='XXXX';
end;
if a then output;
run;

proc print data=sascomm.base noobs;
proc print data=sascomm.a noobs;
proc print data=test noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after uploading your datasets, I see no problems at all:&lt;/P&gt;
&lt;PRE&gt;  id    name

   1    qq   
   2    aa   
   3    ss   
   4    ss   
   5    dd   
   6    dff  
   7    vff  
   8    gggg 
   9    ggggg
  10    rrr  
  11    sss  
  12    ssss 
  13    dddd 
  14    sssss
                

       id

        2
        5
        6
        7
       10
                

  id    name

   1    qq   
   2    XXXX 
   3    ss   
   4    ss   
   5    XXXX 
   6    XXXX 
   7    XXXX 
   8    gggg 
   9    ggggg
  10    XXXX 
  11    sss  
  12    ssss 
  13    dddd 
  14    sssss
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455579#M115265</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-19T12:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455588#M115269</link>
      <description>yes, sascomm.base table is an index table on ID.(didn't upload index table).&lt;BR /&gt;when we perform merge test table doesn't create an index table.</description>
      <pubDate>Thu, 19 Apr 2018 13:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455588#M115269</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-19T13:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455593#M115273</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;data sascomm.base(index=(id));

set sascomm.base;

run;

data test;
merge sascomm.base(in=a) sascomm.a(in=b);
by id;
if a=b then do;
  if name ne ' ' then name='XXXX';
end;
if a then output;
run;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;when we perform this. test table is not creating the index table . I want to get the index table also.&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:10:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455593#M115273</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-19T13:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: merge with index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455597#M115276</link>
      <description>&lt;P&gt;As I already said, use proc datasets to create an index table for a newly created dataset. Index tables are not automatically created.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merge-with-index/m-p/455597#M115276</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-19T13:15:16Z</dc:date>
    </item>
  </channel>
</rss>

