<?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 EG Coding case in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436160#M108471</link>
    <description>&lt;P&gt;Hi please help want to code the following condition in EG&amp;nbsp; using the query builder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= 'INHOUSE' then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name ='INHOUSE';&lt;/P&gt;&lt;P&gt;Agency_Code ='INHOUSE';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;Else If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= '' then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;Agency_Code = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;End;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 06:07:25 GMT</pubDate>
    <dc:creator>anirudhs</dc:creator>
    <dc:date>2018-02-12T06:07:25Z</dc:date>
    <item>
      <title>Code in EG using query builder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436167#M108465</link>
      <description>&lt;P&gt;Hi I want to code the fllowing code in EG using the query builder, can anyone help for doing the same in EG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= 'INHOUSE' then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name ='INHOUSE';&lt;/P&gt;&lt;P&gt;Agency_Code ='INHOUSE';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;Else If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= '' then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;Agency_Code = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;End;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 08:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436167#M108465</guid>
      <dc:creator>anirudhs</dc:creator>
      <dc:date>2018-02-12T08:49:15Z</dc:date>
    </item>
    <item>
      <title>EG Coding case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436160#M108471</link>
      <description>&lt;P&gt;Hi please help want to code the following condition in EG&amp;nbsp; using the query builder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= 'INHOUSE' then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name ='INHOUSE';&lt;/P&gt;&lt;P&gt;Agency_Code ='INHOUSE';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;Else If Substr(Agency_Name,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;7&lt;/STRONG&gt;)= '' then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;Agency_Name = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;Agency_Code = 'UNALLOCATED';&lt;/P&gt;&lt;P&gt;End;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 06:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436160#M108471</guid>
      <dc:creator>anirudhs</dc:creator>
      <dc:date>2018-02-12T06:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code in EG using query builder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436171#M108468</link>
      <description>&lt;P&gt;I assume the "query builder" creates SQL, so:&lt;/P&gt;
&lt;PRE&gt;case when substr(agency_name,1,7)="INHOUSE" then "INHOUSE"
         else "UNALLOCATED" end&lt;/PRE&gt;
&lt;P&gt;For the first variable and then for the second (as each variable is separate in a select clause):&lt;/P&gt;
&lt;PRE&gt;case when substr(agency_name,1,7)="INHOUSE" then "INHOUSE"
         else "UNALLOCATED" end&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 09:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436171#M108468</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-12T09:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: EG Coding case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436189#M108477</link>
      <description>Agency _code &amp;amp; Agency_Name are two different variables... so when Agency_name is Unallocated then other variable be should also allocate the same value.</description>
      <pubDate>Mon, 12 Feb 2018 10:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436189#M108477</guid>
      <dc:creator>anirudhs</dc:creator>
      <dc:date>2018-02-12T10:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: EG Coding case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436190#M108478</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; Please refer to SQL programming help, each variable is "selected" from a datasource so you need at the end:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;select case when substr(agency_name,1,7)="INHOUSE" then "INHOUSE"
            else "UNALLOCATED" end as agency_name,&lt;BR /&gt;       case when substr(agency_name,1,7)="INHOUSE" then "INHOUSE"&lt;BR /&gt;            else "UNALLOCATED" end as agency_code&lt;BR /&gt;...&lt;/PRE&gt;
&lt;P&gt;You cannot set the value of two output variables in one select &amp;lt;variable&amp;gt; line, you need to select data as variable, data as variable,...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 10:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436190#M108478</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-12T10:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: EG Coding case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436191#M108479</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not said in the question if substr(agency_name,1,7) can be somethng else than 'INHOUSE' or ' '.&lt;/P&gt;
&lt;P&gt;Also, substrn should be used instead of substr if the length of agency_name can be shorter than 7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select case when substrn(agency_name,1,7)="INHOUSE" then "INHOUSE"
            when substrn(agency_name,1,7)=' ' then "UNALLOCATED" 
       else agency_name end as agency_name,&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 10:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-in-EG-using-query-builder/m-p/436191#M108479</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-02-12T10:43:26Z</dc:date>
    </item>
  </channel>
</rss>

