<?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 please help me with intersect and except usage in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66045#M18836</link>
    <description>I really only know the very basics of SQL and it sounds like you might need to develop some complex subqueries (though it may be simple and I just don't know SQL well enough to see it)  &lt;BR /&gt;
&lt;BR /&gt;
I would listen to ssb's suggestion, he seems to know his sas.</description>
    <pubDate>Tue, 09 Mar 2010 15:29:15 GMT</pubDate>
    <dc:creator>RickM</dc:creator>
    <dc:date>2010-03-09T15:29:15Z</dc:date>
    <item>
      <title>Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66041#M18832</link>
      <description>HI All,&lt;BR /&gt;
I am trying to pull the common rows/observations from the two tables using only 2 column names that are in common.&lt;BR /&gt;
let us say Table A have 15 columns&lt;BR /&gt;
Table B have 4 columns&lt;BR /&gt;
i would like to create a table C with common rows/obeservations that are in table A and Table B.&lt;BR /&gt;
output table should have common observations with 15 coulmn names&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 here is my code :&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table chr1 as select a.*,b.*&lt;BR /&gt;
from mpark1 as a intersect corr all&lt;BR /&gt;
select janjoin as b&lt;BR /&gt;
on a.surnames=b.surnames and a.pcode=b.pcode;&lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SAS LOG error is as follows:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
501  create table chr1 as select a.*,b.*&lt;BR /&gt;
502  from mpark1 as a intersect corr all&lt;BR /&gt;
503  janjoin as b&lt;BR /&gt;
     -------&lt;BR /&gt;
     79&lt;BR /&gt;
504  on a.surnames=b.surnames;&lt;BR /&gt;
     --&lt;BR /&gt;
     22&lt;BR /&gt;
     76&lt;BR /&gt;
ERROR 79-322: Expecting a SELECT.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ',', AS,&lt;BR /&gt;
              FORMAT, FROM, INFORMAT, INTO, LABEL, LEN, LENGTH, TRANSCODE.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
505  quit;&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: ssas

Message was edited by: ssas</description>
      <pubDate>Tue, 09 Mar 2010 14:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66041#M18832</guid>
      <dc:creator>ssas</dc:creator>
      <dc:date>2010-03-09T14:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66042#M18833</link>
      <description>Intersect and except are for common rows/observations, not variables/columns.</description>
      <pubDate>Tue, 09 Mar 2010 14:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66042#M18833</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-03-09T14:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66043#M18834</link>
      <description>Hi ricky,&lt;BR /&gt;
thanks for reply. I mean to create table with the common observations by using 2 common coloumn names</description>
      <pubDate>Tue, 09 Mar 2010 15:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66043#M18834</guid>
      <dc:creator>ssas</dc:creator>
      <dc:date>2010-03-09T15:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66044#M18835</link>
      <description>You may find the SAS COMPARE procedure useful, at least with some part of your interest here.  The PROC can generate output and has control option/parameters - suggest at least reviewing the DOC.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 09 Mar 2010 15:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66044#M18835</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-09T15:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66045#M18836</link>
      <description>I really only know the very basics of SQL and it sounds like you might need to develop some complex subqueries (though it may be simple and I just don't know SQL well enough to see it)  &lt;BR /&gt;
&lt;BR /&gt;
I would listen to ssb's suggestion, he seems to know his sas.</description>
      <pubDate>Tue, 09 Mar 2010 15:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66045#M18836</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-03-09T15:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66046#M18837</link>
      <description>Try:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table chr1 as select a.*,b.*&lt;BR /&gt;
from mpark1 as a INNER JOIN  janjoin as b&lt;BR /&gt;
on a.surnames=b.surnames and a.pcode=b.pcode;&lt;BR /&gt;
quit;

Of course you are going to have some ambiguous columns so you may have to spell out all the columns you want to keep.&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: Flip</description>
      <pubDate>Tue, 09 Mar 2010 15:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66046#M18837</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-09T15:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66047#M18838</link>
      <description>Thanks a lot Flip for your help.It's really helpful but the thing is when i am using Innerjoin its giving the both records (36k) of Table A(18k records) and Table B(18k records)&lt;BR /&gt;
I can perform Proc sort with nodup option but ??&lt;BR /&gt;
is there any alternative for Except like innerjoin.&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
here is the log;&lt;BR /&gt;
358  proc sql;&lt;BR /&gt;
359  create table test10 as select&lt;BR /&gt;
359! a.member_no,a.fee,a.surnames,a.title,a.pcode,a.expiry,a.joined,a.name,a.dob,a.email,a.cn&lt;BR /&gt;
359! tr,a.postc,&lt;BR /&gt;
360  b.member_no,b.fee,b.surnames,b.title,b.pcode,b.expiry,b.joined,b.name,b.dob,b.email,b.cn&lt;BR /&gt;
360! tr,b.postc&lt;BR /&gt;
361  from lsfeb10.febld as a INNER JOIN lsmar10.marld as b&lt;BR /&gt;
362  on a.surnames=b.surnames and a.pcode=b.pcode;&lt;BR /&gt;
WARNING: Variable Member_No already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable FEE already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Surnames already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Title already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable PCODE already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Expiry already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Joined already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Name already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Dob already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable Email already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable cntr already exists on file WORK.TEST10.&lt;BR /&gt;
WARNING: Variable postc already exists on file WORK.TEST10.&lt;BR /&gt;
NOTE: Table WORK.TEST10 created, with 37858 rows and 12 columns.&lt;BR /&gt;
&lt;BR /&gt;
363  quit;&lt;BR /&gt;
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be&lt;BR /&gt;
      shifted by the "BEST" format.&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           1.90 seconds&lt;BR /&gt;
      cpu time            0.14 seconds&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: ssas

Message was edited by: ssas</description>
      <pubDate>Wed, 10 Mar 2010 09:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66047#M18838</guid>
      <dc:creator>ssas</dc:creator>
      <dc:date>2010-03-10T09:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Please please help me with intersect and except usage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66048#M18839</link>
      <description>359! a.member_no,a.fee,a.surnames,a.title,a.pcode,a.expiry,a.joined,a.name,a.dob,a.email,a.cn&lt;BR /&gt;
359! tr,a.postc,&lt;BR /&gt;
360 b.member_no,b.fee,b.surnames,b.title,b.pcode,b.expiry,b.joined,b.name,b.dob,b.email,b.cn&lt;BR /&gt;
&lt;BR /&gt;
Which member_no do you want?  Pick one or rename one like b.member_no as new_member.  for each variable.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Try &lt;BR /&gt;
&lt;BR /&gt;
select * from d1&lt;BR /&gt;
   intersect corr all&lt;BR /&gt;
   select * from d2;</description>
      <pubDate>Wed, 10 Mar 2010 13:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-please-help-me-with-intersect-and-except-usage/m-p/66048#M18839</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-10T13:50:06Z</dc:date>
    </item>
  </channel>
</rss>

