<?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: Check for non-existing columns in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147875#M11639</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the best is to make sure that you always have the columns that you use in your calculations. One way to handle that is to use template (empty) tables, than append your intermediate data to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One other way is to use macro coding, where you can conditionally execute regular SAS code (SQL/Data step/PROC steps).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is best depends on how big this problem is, is this some kind of production code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Mar 2014 19:40:24 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2014-03-18T19:40:24Z</dc:date>
    <item>
      <title>Check for non-existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147874#M11638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;HEllo EG Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for ways to check for non-existing columns in my intermediate datasets. For example, I calculate sum of two columns A and B as Total&lt;/P&gt;&lt;P&gt;sum(t1.A, t1.B) is computed column Total. However in some scenarios, A might not just exist, and it by that I don't mean that the data is missing and saved as . for column titled A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there relevant IF statements in conditional category that can be used to these kind of checks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In theory, following code would have worked if I had both columns A and B and the data was missing (.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;when t1.A = '.' then sum(t1.B)&lt;/P&gt;&lt;P&gt;when t1.B = '.' then sum(t1.A)&lt;/P&gt;&lt;P&gt;else sum(t1.A, t1.B)&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However how I do I go about checking for non-existing columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dhanashree&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 18:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147874#M11638</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-03-18T18:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147875#M11639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the best is to make sure that you always have the columns that you use in your calculations. One way to handle that is to use template (empty) tables, than append your intermediate data to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One other way is to use macro coding, where you can conditionally execute regular SAS code (SQL/Data step/PROC steps).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is best depends on how big this problem is, is this some kind of production code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 19:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147875#M11639</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-03-18T19:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147876#M11640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't exactly understand what you need, but here are a couple of options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Data Set Attributes task in EG produces a SAS dataset containing one row for each column in the datasets;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PROC SQL, you can query the tables in the "dictionary" library to check what columns exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 20:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147876#M11640</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-03-18T20:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147877#M11641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I guess the solution to using column names from dictionary will be useful as well.&lt;/P&gt;&lt;P&gt;Appreciate the guideline RW9 &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>Wed, 19 Mar 2014 13:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-non-existing-columns/m-p/147877#M11641</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-03-19T13:06:38Z</dc:date>
    </item>
  </channel>
</rss>

