<?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: Multiple column in subquery in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888814#M351127</link>
    <description>&lt;P&gt;Looks to be an inner join or you can use pass thru as indicated by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select e.* 
from emp as e
inner join emp_master as em
on e.empid=em.empid and e.name=em.name;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2023 16:06:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-08-10T16:06:41Z</dc:date>
    <item>
      <title>Multiple column in subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888786#M351112</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table test AS&lt;BR /&gt;select * from emp where (empid, name) in (select empid,name from emp_master);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;same code is working in the sql server but not in the sas.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How we can add multiple columns in the subquery.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 12:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888786#M351112</guid>
      <dc:creator>Shantaram</dc:creator>
      <dc:date>2023-08-10T12:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple column in subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888801#M351117</link>
      <description>&lt;P&gt;Always a good idea to check the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/sqlproc/p020urejdmvi7vn1t9avbvazqapu.htm" target="_self"&gt;documentation&lt;/A&gt;, which explains:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PROC SQL allows a subquery (contained in parentheses) at any point in an expression where a simple column value or constant can be used. In this case, a subquery must return a single value, that is, one row with only one column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Probably, you can use the PASSTHRU feature in SAS PROC SQL to run native SQL Server code inside SAS PROC SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 14:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888801#M351117</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-10T14:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple column in subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888802#M351118</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45547"&gt;@Shantaram&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table test AS&lt;BR /&gt;select * from emp where (empid, name) in (select empid,name from emp_master);&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;same code is working in the sql server but not in the sas.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How we can add multiple columns in the subquery.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If possible then run the query on data in SQL server and then bring the result to SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not even sure exactly what your query is supposed to return (no data or example for instance). You might run an actual query and see if a join on that result will work such as on (and I am guessing here) ON t1.Empid=t2.Empid and t1.Name= t2.Name &amp;nbsp; where T1 and T2 are aliases for the tables the value come from. The general way that IN comparisons work in SAS anything that looks like (a, b) in (any list of values) is going to be a syntax error as far as I can tell. IN is looking for one value in a list of other values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Do&lt;/STRONG&gt; &lt;STRONG&gt;not&lt;/STRONG&gt; expect syntax from different flavors of SQL to run as Proc SQL code as almost every implementation has extensions to "standard" SQL and Proc SQL doesn't have them.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 14:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888802#M351118</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-10T14:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple column in subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888814#M351127</link>
      <description>&lt;P&gt;Looks to be an inner join or you can use pass thru as indicated by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select e.* 
from emp as e
inner join emp_master as em
on e.empid=em.empid and e.name=em.name;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 16:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-column-in-subquery/m-p/888814#M351127</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-08-10T16:06:41Z</dc:date>
    </item>
  </channel>
</rss>

