<?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: HELP - Proc sql error: The following columns were not found in the contributing tables.. in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166737#M3207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code as such works as below example using "sashelp.class" demonstrates. Not sure why you use a double ampersand in "&amp;amp;&amp;amp;step". A single ampersand would be sufficient in the code you've posted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your code is not working then either your variable doesn't exist OR it doesn't follow the SAS naming standards. If if's a non complying variable name then pass it to the program as SAS name literal in the form: "my variable"n&lt;/P&gt;&lt;P&gt;I've added such quoting already to the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let main=sashelp.class;&lt;/P&gt;&lt;P&gt;%let step=height;&lt;/P&gt;&lt;P&gt;%let id=age;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro dups_table (dsin=&amp;amp;main);&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table dups_&amp;amp;step as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, count(*) as count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &amp;amp;dsin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where "&amp;amp;id"n ne 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by "&amp;amp;step"n&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having count(*) &amp;gt; 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc print data=dups_&amp;amp;step;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "Matched by &amp;amp;step.";&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend dups_table;&lt;/P&gt;&lt;P&gt;%dups_table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Jul 2014 02:19:11 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2014-07-05T02:19:11Z</dc:date>
    <item>
      <title>HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166731#M3201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been getting the following error :" ERROR: The following columns were not found in the contributing tables: ..." when I run a query to create a table of dupicated ids.&amp;nbsp;&amp;nbsp; The thing is I haven't changed the code, and it worked before so I don't understand why I'm getting this error message and am at a lost at how to resolve it.&amp;nbsp; If anyone can help that would be appreciated. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let main= my dataset;&lt;/P&gt;&lt;P&gt;%let id= my id;&lt;/P&gt;&lt;P&gt;%let step= my step;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro dups_table (dsin=&amp;amp;main);&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table dups_&amp;amp;&amp;amp;step as&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, count(*) as count&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &amp;amp;dsin &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &amp;amp;id ne 0&lt;BR /&gt; group by &amp;amp;step&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; having count(*) &amp;gt; 1&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc print data=dups_&amp;amp;&amp;amp;step;&lt;BR /&gt;title "Matched by &amp;amp;step.";&lt;BR /&gt;run;&lt;BR /&gt;%mend dups_table;&lt;BR /&gt;%dups_table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 14:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166731#M3201</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-04T14:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166732#M3202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure, why there is a space between&amp;nbsp; my dataset, my id, my step&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let main= my dataset;&lt;/P&gt;&lt;P&gt;%let id= my id;&lt;/P&gt;&lt;P&gt;%let step= my step;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 15:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166732#M3202</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-07-04T15:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166733#M3203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry, i just removed the original variables and typed freehand as I have a total of 25 steps with different names.&amp;nbsp; It should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%let main=my_dataset;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%let&lt;/SPAN&gt; step=my_step;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%let&lt;/SPAN&gt; id=my_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 15:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166733#M3203</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-04T15:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166734#M3204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post a proc contents from your data set, most likely the error is correct. If you run it with different data sets and make a mistake with one of the vars this will happen. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 19:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166734#M3204</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-04T19:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166735#M3205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The thing is when I do a proc content of the dataset in question, the variable is there.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 20:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166735#M3205</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-04T20:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166736#M3206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post full code and log, including results from proc content.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 20:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166736#M3206</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-04T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166737#M3207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code as such works as below example using "sashelp.class" demonstrates. Not sure why you use a double ampersand in "&amp;amp;&amp;amp;step". A single ampersand would be sufficient in the code you've posted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your code is not working then either your variable doesn't exist OR it doesn't follow the SAS naming standards. If if's a non complying variable name then pass it to the program as SAS name literal in the form: "my variable"n&lt;/P&gt;&lt;P&gt;I've added such quoting already to the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let main=sashelp.class;&lt;/P&gt;&lt;P&gt;%let step=height;&lt;/P&gt;&lt;P&gt;%let id=age;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro dups_table (dsin=&amp;amp;main);&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table dups_&amp;amp;step as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, count(*) as count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &amp;amp;dsin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where "&amp;amp;id"n ne 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by "&amp;amp;step"n&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having count(*) &amp;gt; 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc print data=dups_&amp;amp;step;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "Matched by &amp;amp;step.";&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend dups_table;&lt;/P&gt;&lt;P&gt;%dups_table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jul 2014 02:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166737#M3207</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-07-05T02:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166738#M3208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;My apologies for the late reply, attached are the files you requested.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 13:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166738#M3208</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-07T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166739#M3209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tips Patrick.&amp;nbsp; Unfortuately, I am still getting the error message. =(&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 13:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166739#M3209</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-07T13:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166740#M3210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easy way of looking at it, copy and paste the code to replace macro variables:&lt;/P&gt;&lt;P&gt;%macro dups_table (dsin=&amp;amp;main);&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table dups_step2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, count(*) as count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from step2 (keep= WNV_ID ID_S2 Specimen__ Patient_ID Patient_Given_Names Patient_Date_of_Birth Patient_Age Patient_Gender&lt;/P&gt;&lt;P&gt; Patient_City Patient_City_Desc Patient_Health_No )&lt;/P&gt;&lt;P&gt; where ID_S2 ne 0&lt;/P&gt;&lt;P&gt; group by step2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; having count(*) &amp;gt; 1&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see above your keep= statement does not mention&amp;nbsp; the variable STEP2, hence it is not present to the SQL statement however you are trying to group your data by that STEP2 variable, hence an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 13:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166740#M3210</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-07T13:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166741#M3211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza,&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="813022" data-username="stat%40sas" href="https://communities.sas.com/people/stat@sas" id="jive-81302220120436963529186"&gt;stat@sas&lt;/A&gt;, and Patrick for your help! I just wanted to let you know I figured it out my looking over the files you requested.&amp;nbsp; I got the error because I dropped the variable in question in a keep statement...I guess I needed a weekend away from coding to see clearly. =P&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 14:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166741#M3211</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-07T14:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: HELP - Proc sql error: The following columns were not found in the contributing tables..</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166742#M3212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks RW9!&amp;nbsp; That was what I figured out this morning... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 15:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HELP-Proc-sql-error-The-following-columns-were-not-found-in-the/m-p/166742#M3212</guid>
      <dc:creator>Vikachu</dc:creator>
      <dc:date>2014-07-07T15:25:41Z</dc:date>
    </item>
  </channel>
</rss>

