<?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 How do I see if records with matching keys are in both files in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508062#M1585</link>
    <description>&lt;P&gt;How do I see if records with matching keys are in both files and then output only the records that are in the second file into a new file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table cohort2 as&lt;BR /&gt;&amp;nbsp; select *&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;from etl.inp_claims_lds2013_2014_lejr etl.inp_claims_lds2015_2016_lejr&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where etl.inp_claims_lds2015_2016_lejr.desy_sort_key in (select&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; desy_sort_key from etl.inp_claims_lds2013_2014_lejr);&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Sun, 28 Oct 2018 01:41:51 GMT</pubDate>
    <dc:creator>fpascal</dc:creator>
    <dc:date>2018-10-28T01:41:51Z</dc:date>
    <item>
      <title>How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508062#M1585</link>
      <description>&lt;P&gt;How do I see if records with matching keys are in both files and then output only the records that are in the second file into a new file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table cohort2 as&lt;BR /&gt;&amp;nbsp; select *&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;from etl.inp_claims_lds2013_2014_lejr etl.inp_claims_lds2015_2016_lejr&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where etl.inp_claims_lds2015_2016_lejr.desy_sort_key in (select&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; desy_sort_key from etl.inp_claims_lds2013_2014_lejr);&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 01:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508062#M1585</guid>
      <dc:creator>fpascal</dc:creator>
      <dc:date>2018-10-28T01:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508063#M1586</link>
      <description>&lt;P&gt;What do you think is wrong with your code. Seems ok or am i not understanding your description?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 01:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508063#M1586</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T01:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508064#M1587</link>
      <description>75&lt;BR /&gt;76 * Log/List Options *;&lt;BR /&gt;77 options ls=120 ps=42 missing=' ' nocenter validvarname=upcase compress=binary;&lt;BR /&gt;78 * Output SAS Library *;&lt;BR /&gt;79 libname etl 'D:\Medicare\05_etl_output\';&lt;BR /&gt;NOTE: Libref ETL was successfully assigned as follows:&lt;BR /&gt;Engine: V9&lt;BR /&gt;Physical Name: D:\Medicare\05_etl_output&lt;BR /&gt;80&lt;BR /&gt;81&lt;BR /&gt;82 proc sql;&lt;BR /&gt;83 create table cohort2 as&lt;BR /&gt;84 select *&lt;BR /&gt;85 from etl.inp_claims_lds2013_2014_lejr etl.inp_claims_lds2015_2016_lejr&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, ',', ANSIMISS, CROSS, EXCEPT, FULL, GROUP, HAVING,&lt;BR /&gt;INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE.&lt;BR /&gt;&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;86 where etl.inp_claims_lds2015_2016_lejr.desy_sort_key in (select&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND,&lt;BR /&gt;BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE,&lt;BR /&gt;LT, LTT, NE, NET, NOT, NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;87 desy_sort_key from etl.inp_claims_lds2013_2014_lejr);&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;88 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.04 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Oct 2018 01:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508064#M1587</guid>
      <dc:creator>fpascal</dc:creator>
      <dc:date>2018-10-28T01:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508069#M1588</link>
      <description>&lt;P&gt;my tired eyes didn't capture the missing comma in from clause&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from etl.inp_claims_lds2013_2014_lejr&amp;nbsp; &amp;nbsp;,&amp;nbsp; &amp;nbsp; etl.inp_claims_lds2015_2016_lejr&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;check that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also, at late evening here don't trust my eyes&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508069#M1588</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T02:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508070#M1589</link>
      <description>Almost there&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;80&lt;BR /&gt;81&lt;BR /&gt;82 proc sql;&lt;BR /&gt;83 create table cohort2 as&lt;BR /&gt;84 select *&lt;BR /&gt;85 from etl.inp_claims_lds2013_2014_lejr, etl.inp_claims_lds2015_2016_lejr&lt;BR /&gt;86 where etl.inp_claims_lds2015_2016_lejr.desy_sort_key in (select&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND,&lt;BR /&gt;BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE,&lt;BR /&gt;LT, LTT, NE, NET, NOT, NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;87 desy_sort_key from etl.inp_claims_lds2013_2014_lejr);&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;88 quit;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:05:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508070#M1589</guid>
      <dc:creator>fpascal</dc:creator>
      <dc:date>2018-10-28T02:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508071#M1590</link>
      <description>&lt;P&gt;what's your objective&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you after this logic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select * &lt;BR /&gt;from b&lt;BR /&gt;where key in (select key from a);&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508071#M1590</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T02:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508072#M1591</link>
      <description>I want to take check each record in file a to see if it is in file b. If so I want to add it to a new file c.&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508072#M1591</guid>
      <dc:creator>fpascal</dc:creator>
      <dc:date>2018-10-28T02:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508075#M1594</link>
      <description>&lt;P&gt;You are better off posting a sample of your data and the requirement&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508075#M1594</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T02:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508077#M1595</link>
      <description>&lt;P&gt;SAS/SQL doesn't support 3-level variable names. You must use aliasses :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;from etl.inp_claims_lds2013_2014_lejr as a, etl.inp_claims_lds2015_2016_lejr as b
       where b.desy_sort_key in (select
        desy_sort_key from etl.inp_claims_lds2013_2014_lejr)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Oct 2018 03:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508077#M1595</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-28T03:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I see if records with matching keys are in both files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508081#M1596</link>
      <description>&lt;P&gt;thanks - below it states it cannot find my files but they are in library ETL.&amp;nbsp; Is there something else i need to add&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;73 libname etl 'D:\Medicare\05_etl_output\';&lt;BR /&gt;NOTE: Libref ETL was successfully assigned as follows:&lt;BR /&gt;Engine: V9&lt;BR /&gt;Physical Name: D:\Medicare\05_etl_output&lt;BR /&gt;74&lt;BR /&gt;75 proc sql;&lt;BR /&gt;76 create table cohort as&lt;BR /&gt;77 select *&lt;BR /&gt;78 from etl.inp_claims_2013_2014_lejr as a, etl.inp_claims_2015_2016_lejr as b&lt;BR /&gt;79 where b.desy_sort_key in (select&lt;BR /&gt;80 desy_sort_key from a);&lt;BR /&gt;ERROR: File ETL.INP_CLAIMS_2013_2014_LEJR.DATA does not exist.&lt;BR /&gt;ERROR: File ETL.INP_CLAIMS_2015_2016_LEJR.DATA does not exist.&lt;BR /&gt;ERROR: File WORK.A.DATA does not exist.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;81 quit;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 04:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-see-if-records-with-matching-keys-are-in-both-files/m-p/508081#M1596</guid>
      <dc:creator>fpascal</dc:creator>
      <dc:date>2018-10-28T04:17:12Z</dc:date>
    </item>
  </channel>
</rss>

