<?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: Exclude columns using proc SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115064#M31818</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have teradata, thus I can't test an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both of the following work for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want (drop=sex) as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class (drop=sex)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Nov 2012 20:03:20 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-11-01T20:03:20Z</dc:date>
    <item>
      <title>Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115061#M31815</link>
      <description>&lt;P&gt;Hi.. I know there are many SQL experts here (obviously I'm not one). .. I'm trying to link 2 tables, one is a data warehouse on the server and the other is on my local machine.. How can I select only certain columns from the the server table. Here is the code I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;
PROC SQL;
 connect to server(user=&amp;amp;user. password=&amp;amp;password. Mode=TTTTT 
 tdpid=ssss);

create table ABC.AAA_BBB (compress=yes reuse=yes) as
 select distinct a.*, b.*
 from ABC.AAA_DDD a join (Select * from connection to teradata&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 &amp;nbsp;&amp;nbsp; (select * from SDW001.STN_DLY)) b
 on b.ast_id = a.ast_id
 order by a.ast_id ;
quit;
endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SDW001 has 20 columns , 4 that are shared between ABC.AAA_DDD, but I only want all but 3 columns.. I want to drop the ones that are shared between ABC.AAA_DDD and SDW001&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 12:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115061#M31815</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2018-09-21T12:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115062#M31816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when you specify the tables in your from statement (e.g., from ABC, etc) you can use data set options like keep and drop.&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt; from ABC (keep=this that something_else),BBB (drop=var6 var_whatever).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 19:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115062#M31816</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-01T19:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115063#M31817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would I specify (using my code as an example) that I don't want to include CAPTR_DT from the SDW001.STN_DLY table ?.. because I have tried wiht drop and keep in different areas of the code and nothing worked for me..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 19:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115063#M31817</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2012-11-01T19:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115064#M31818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have teradata, thus I can't test an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both of the following work for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want (drop=sex) as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class (drop=sex)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 20:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115064#M31818</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-01T20:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115065#M31819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select only the list of variable you want in the output table...for eg&lt;/P&gt;&lt;P&gt;instead of &lt;/P&gt;&lt;P&gt;select * from&lt;/P&gt;&lt;P&gt;try using &lt;/P&gt;&lt;P&gt;select col1,col2,col3 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 20:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115065#M31819</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-11-01T20:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude columns using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115066#M31820</link>
      <description>&lt;P&gt;Your existing code probably actually does what you want.&amp;nbsp; When you use SELECT A.*,B.* and there are variables in the table referenced by B that also exist in the table referenced by A then SAS will not add them to the output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the best solution is to &lt;STRONG&gt;list&amp;nbsp;only the fields you need&lt;/STRONG&gt; in the pass through SQL query.&amp;nbsp; This will make sure that you only move data that you need from the Teradata server to the SAS server.&amp;nbsp; You can query the SAS or Teradata metadata to get a list of the variables and just delete the three that you do not want.&amp;nbsp; If you are using Teradata's free SQL Assistant application it is easy to get the list by just right clicking on the table name and selecting browse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the DROP/KEEP approach, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;said:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Both of the following work for me:&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;
&amp;nbsp; create table want (drop=sex) as
&amp;nbsp;&amp;nbsp;&amp;nbsp; select *
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class
&amp;nbsp; ;
quit;


proc sql;
&amp;nbsp; create table want as
&amp;nbsp;&amp;nbsp;&amp;nbsp; select *
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class (drop=sex)
&amp;nbsp; ;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 21 Sep 2018 12:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Exclude-columns-using-proc-SQL/m-p/115066#M31820</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-21T12:36:42Z</dc:date>
    </item>
  </channel>
</rss>

