<?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: How to select all but some of matching or ID variables in condition statement in SQL? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82002#M17715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the name of one of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; create table outfile2(drop=xxx) as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from outfile1 as a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile(rename=(Scenerio_Id=xxx)) as b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.Scenario_ID=b.xxx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Mar 2013 21:21:30 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-03-19T21:21:30Z</dc:date>
    <item>
      <title>How to select all but some of matching or ID variables in condition statement in SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82000#M17713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;outfile and outfile1 have many variables with Scenario_ID the first variable respectively.&amp;nbsp; So it is impractical to list all of them. I would like to select all the variables from these two files but without the duplicate Scenario_ID column.&lt;/P&gt;&lt;P&gt;How to do this without a warning message? The following code will cause a warning message of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WARNING: Variable Scenario_ID already exists on file outfile:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table outfile2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.*, b.*&lt;/P&gt;&lt;P&gt;&amp;nbsp; from outfile1 as a right join outfile as b&lt;/P&gt;&lt;P&gt;&amp;nbsp; on a.Scenario_ID=b.Scenario_ID;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to let Scenario_ID be the first variable in outfile2 without duplicate Scenario_ID warning sign?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 20:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82000#M17713</guid>
      <dc:creator>Macro</dc:creator>
      <dc:date>2013-03-19T20:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to select all but some of matching or ID variables in condition statement in SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82001#M17714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Explicitly list the variables from b and leave out b.Scenario_ID to remove the warning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or live with the warning, it is only reminding you that both data sets contributed. Since they have the same value due to your join there isn't a problem. The warning is for other variables that you don't address, for example a.name and b.name, you may not get the one you want in all cases.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 20:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82001#M17714</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-03-19T20:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to select all but some of matching or ID variables in condition statement in SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82002#M17715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the name of one of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; create table outfile2(drop=xxx) as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from outfile1 as a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile(rename=(Scenerio_Id=xxx)) as b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.Scenario_ID=b.xxx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 21:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82002#M17715</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-19T21:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to select all but some of matching or ID variables in condition statement in SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82003#M17716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom. That works. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 17:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82003#M17716</guid>
      <dc:creator>Macro</dc:creator>
      <dc:date>2013-03-21T17:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to select all but some of matching or ID variables in condition statement in SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82004#M17717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, what if there is no create table statement in the above code and only select statement exists. In that case, how to efficiently drop some of variables in the condition statement in output result assuming there are many variables in a and b? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 17:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-all-but-some-of-matching-or-ID-variables-in/m-p/82004#M17717</guid>
      <dc:creator>Macro</dc:creator>
      <dc:date>2013-03-21T17:14:22Z</dc:date>
    </item>
  </channel>
</rss>

