<?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: How can i search one table  for an obs? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-i-search-one-table-for-an-obs/m-p/2409#M808</link>
    <description>Hi!&lt;BR /&gt;
  Rather than use PROC COMPARE, I'd probably do an SQL join or a SAS merge with a BY statement. The only downside of the SAS merge is that both datasets need to be sorted by the variables in the BY statement. And, it's only a downside if you don't have enough memory to sort the big dataset.&lt;BR /&gt;
  Here's an SQL join example to create your table:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table getsearch as&lt;BR /&gt;
  select srch.a, srch.b, srch.c, srch.d, srch.e, srch.f,&lt;BR /&gt;
         srch.g, srch.h, srch.i, srch.j, srch.k, srch.l&lt;BR /&gt;
         srch.m, big.o, big.p&lt;BR /&gt;
  from search as srch,&lt;BR /&gt;
       sasuser.data1 as big&lt;BR /&gt;
  where srch.a=big.a and&lt;BR /&gt;
        srch.b=big.b and&lt;BR /&gt;
        srch.c=big.c and&lt;BR /&gt;
        srch.d=big.d and&lt;BR /&gt;
        srch.e=big.e and&lt;BR /&gt;
        srch.f=big.f and&lt;BR /&gt;
        srch.g=big.g and&lt;BR /&gt;
        srch.h=big.h and&lt;BR /&gt;
        srch.i=big.i and&lt;BR /&gt;
        srch.j=big.j and&lt;BR /&gt;
        srch.k=big.k and&lt;BR /&gt;
        srch.l=big.l and&lt;BR /&gt;
        srch.m=big.m;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=getsearch;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
If you need more help, you might consider contacting SAS Technical Support, because, depending on the size of your files and subsequent processing and whether you need to have the non-matches as well as the matches, it might turn out that a MERGE would work out better for you. They could help you understand how a Data Step MERGE differs from an SQL join. To find out how to contact Tech Support, refer to:&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
    <pubDate>Mon, 05 Mar 2007 17:52:39 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-03-05T17:52:39Z</dc:date>
    <item>
      <title>How can i search one table  for an obs?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-i-search-one-table-for-an-obs/m-p/2408#M807</link>
      <description>hi,&lt;BR /&gt;
i have a table "search" with one or more obs (variables A-M)&lt;BR /&gt;
i also have a huge table "Sasuser.Data1" which has 1 million obs (variables A-M and Variables O and P)&lt;BR /&gt;
&lt;BR /&gt;
what i need to do is search my DATA1 table for the obs in "search" and IF there is a match for ALL variables (A-M), then return variables O and P.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
is this possible?&lt;BR /&gt;
&lt;BR /&gt;
what is have so far is:&lt;BR /&gt;
&lt;BR /&gt;
Libname sasuser;&lt;BR /&gt;
options nodate pageno=1 linesize=80 pagesize=40;&lt;BR /&gt;
proce compare base=work.search compare = sasuser.data1 listequalvar;&lt;BR /&gt;
??????&lt;BR /&gt;
run;</description>
      <pubDate>Sun, 04 Mar 2007 05:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-i-search-one-table-for-an-obs/m-p/2408#M807</guid>
      <dc:creator>sssb2000</dc:creator>
      <dc:date>2007-03-04T05:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can i search one table  for an obs?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-i-search-one-table-for-an-obs/m-p/2409#M808</link>
      <description>Hi!&lt;BR /&gt;
  Rather than use PROC COMPARE, I'd probably do an SQL join or a SAS merge with a BY statement. The only downside of the SAS merge is that both datasets need to be sorted by the variables in the BY statement. And, it's only a downside if you don't have enough memory to sort the big dataset.&lt;BR /&gt;
  Here's an SQL join example to create your table:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table getsearch as&lt;BR /&gt;
  select srch.a, srch.b, srch.c, srch.d, srch.e, srch.f,&lt;BR /&gt;
         srch.g, srch.h, srch.i, srch.j, srch.k, srch.l&lt;BR /&gt;
         srch.m, big.o, big.p&lt;BR /&gt;
  from search as srch,&lt;BR /&gt;
       sasuser.data1 as big&lt;BR /&gt;
  where srch.a=big.a and&lt;BR /&gt;
        srch.b=big.b and&lt;BR /&gt;
        srch.c=big.c and&lt;BR /&gt;
        srch.d=big.d and&lt;BR /&gt;
        srch.e=big.e and&lt;BR /&gt;
        srch.f=big.f and&lt;BR /&gt;
        srch.g=big.g and&lt;BR /&gt;
        srch.h=big.h and&lt;BR /&gt;
        srch.i=big.i and&lt;BR /&gt;
        srch.j=big.j and&lt;BR /&gt;
        srch.k=big.k and&lt;BR /&gt;
        srch.l=big.l and&lt;BR /&gt;
        srch.m=big.m;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=getsearch;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
If you need more help, you might consider contacting SAS Technical Support, because, depending on the size of your files and subsequent processing and whether you need to have the non-matches as well as the matches, it might turn out that a MERGE would work out better for you. They could help you understand how a Data Step MERGE differs from an SQL join. To find out how to contact Tech Support, refer to:&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 05 Mar 2007 17:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-i-search-one-table-for-an-obs/m-p/2409#M808</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-03-05T17:52:39Z</dc:date>
    </item>
  </channel>
</rss>

