<?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 Check for existing column in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185831#M14244</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 writing simple computed columns in SAS EG that calculate Total = sum(t1.var1,t1.var2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, sometimes the dataset may end up not having var1 at all since this dataset is being put together after multiple filters, transpose and merges.&lt;/P&gt;&lt;P&gt;So is there a way to determine if the column being used in the calculation exists before it is used in the equation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXIST function is useful to verify if dataset exists, and not quite helpful in this scenrio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any reference to var1 will give me error that says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Column var1 could not be found in the table/view identified with the correlation name T1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So does SAS Eg provide a way to check if column exists?&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, 25 Feb 2014 13:45:43 GMT</pubDate>
    <dc:creator>noobs</dc:creator>
    <dc:date>2014-02-25T13:45:43Z</dc:date>
    <item>
      <title>Check for existing column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185831#M14244</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 writing simple computed columns in SAS EG that calculate Total = sum(t1.var1,t1.var2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, sometimes the dataset may end up not having var1 at all since this dataset is being put together after multiple filters, transpose and merges.&lt;/P&gt;&lt;P&gt;So is there a way to determine if the column being used in the calculation exists before it is used in the equation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXIST function is useful to verify if dataset exists, and not quite helpful in this scenrio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any reference to var1 will give me error that says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Column var1 could not be found in the table/view identified with the correlation name T1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So does SAS Eg provide a way to check if column exists?&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, 25 Feb 2014 13:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185831#M14244</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-02-25T13:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Check for existing column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185832#M14245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not that I know of. If you want to check this, you need some kind of macro'ish logic somewhere in your flow.&lt;/P&gt;&lt;P&gt;Perhaps it's easier to code in some way that you always will have var1, like having a template table which append to, or doing something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set template&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..Your&amp;nbsp; EG task...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can't tell how to implement this since I know nothing of the rest of the flow, amount of user written vs Tasks etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185832#M14245</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-02-25T14:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Check for existing column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185833#M14246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rather than hardcoding the list of variables to add into the sum and having to check existence, why not just start with an identifiable column range, say call all the ones you do want to sum have a prefix of SUM_, then use sql to create the macro variable with these in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distinct NAME&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :LIST_OF_SUM separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DICTIONARY.COLUMNS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LIBNAME="&lt;EM&gt;your libname here&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMNAME="&lt;EM&gt;your dataset here"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; substr(NAME,1,3)="SUM";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put &amp;amp;LIST_OF_SUM.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Possible output:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM_COL1, SUM_COL2... */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way only variables which exist will be in your macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 15:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185833#M14246</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-02-25T15:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check for existing column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185834#M14247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;alright thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 21:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Check-for-existing-column/m-p/185834#M14247</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-02-27T21:00:53Z</dc:date>
    </item>
  </channel>
</rss>

