<?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: Joining a SAS table with a Sybase pull in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/751845#M236742</link>
    <description>&lt;P&gt;Yes you can.&lt;/P&gt;
&lt;P&gt;The code in blue below is SAS code and the code in red is Sybase code.&lt;/P&gt;
&lt;P&gt;You can add any SAS code at all. For example:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;libname SYB sybase server=&amp;amp;server database=&amp;amp;databse user=&amp;amp;user pwd=&amp;amp;pwd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;proc sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; connect using SYB;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; create table TABLE as&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; select *&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; from connection to SYB&lt;/FONT&gt; &lt;FONT color="#0000FF"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;nbsp; select ...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; )&amp;nbsp;&lt;FONT color="#0000FF"&gt; a&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; left join&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; SASLIB.SASTABLE b&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; on a.ID=b.ID&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; %put &amp;amp;sqlxmsg;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jul 2021 02:26:33 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-07-03T02:26:33Z</dc:date>
    <item>
      <title>Joining a SAS table with a Sybase pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/751762#M236697</link>
      <description>&lt;P&gt;I'm using code inherited from someone else.&amp;nbsp; The tables being used are being connected to using the sybase connection directly in the proc sql statement (see code below ).&amp;nbsp; I've done some performance testing and this is faster than using a libname statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I have some tables that I'd like to pull in that are in a SAS library but since they aren't in the sybase database, that's not working.&amp;nbsp; Two are basically just used for indicators so I was able to use a macro variable for that.&amp;nbsp; However, one table has over 100K observations and I need to pull in a field from that table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is basically, is there a way to join a table using the sybase connection with a SAS table in one step?&amp;nbsp; Or do I just need to use two steps?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&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;
CONNECT TO sybase(server=&amp;amp;server.
                  database=&amp;amp;databse.
                  user=&amp;amp;user. 
                  password=&amp;amp;password.);

Create table Table as
Select *
From Connection to Sybase(

Select &lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;%put &amp;amp;sqlxmsg;&lt;BR /&gt;Disconnect from Sybase;&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jul 2021 15:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/751762#M236697</guid>
      <dc:creator>Albr0166</dc:creator>
      <dc:date>2021-07-02T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Joining a SAS table with a Sybase pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/751845#M236742</link>
      <description>&lt;P&gt;Yes you can.&lt;/P&gt;
&lt;P&gt;The code in blue below is SAS code and the code in red is Sybase code.&lt;/P&gt;
&lt;P&gt;You can add any SAS code at all. For example:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;libname SYB sybase server=&amp;amp;server database=&amp;amp;databse user=&amp;amp;user pwd=&amp;amp;pwd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;proc sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; connect using SYB;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; create table TABLE as&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; select *&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; from connection to SYB&lt;/FONT&gt; &lt;FONT color="#0000FF"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;nbsp; select ...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; )&amp;nbsp;&lt;FONT color="#0000FF"&gt; a&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; left join&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; SASLIB.SASTABLE b&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; on a.ID=b.ID&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;&amp;nbsp; %put &amp;amp;sqlxmsg;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2021 02:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/751845#M236742</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-03T02:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Joining a SAS table with a Sybase pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752312#M236951</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;That's really helpful.&amp;nbsp; This is (probably) a stupid question, but how would I pull in fields from table B?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 13:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752312#M236951</guid>
      <dc:creator>Albr0166</dc:creator>
      <dc:date>2021-07-06T13:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Joining a SAS table with a Sybase pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752403#M237001</link>
      <description>&lt;P&gt;Add them to your SELECT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 20:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752403#M237001</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-07-06T20:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Joining a SAS table with a Sybase pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752451#M237032</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;select *&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;means all variables from all tables&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 22:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-a-SAS-table-with-a-Sybase-pull/m-p/752451#M237032</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-06T22:11:07Z</dc:date>
    </item>
  </channel>
</rss>

