<?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: Convert MS Access iif to macro %iif in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595436#M171295</link>
    <description>Doh!  That did the trick!  Thanks so very much!</description>
    <pubDate>Thu, 10 Oct 2019 15:03:44 GMT</pubDate>
    <dc:creator>tomrvincent</dc:creator>
    <dc:date>2019-10-10T15:03:44Z</dc:date>
    <item>
      <title>Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595366#M171251</link>
      <description>&lt;P&gt;Does anyone know a way to convert the MS Access iif function to a case statement *in bulk*?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm converting Access apps to SAS and found one with dozens of iif statements and I thought it would be 'fun' (sick, yes, I know) to try to come up with a way to take this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IIf(MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and write a macro so that I could simply do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%IIf(MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that would convert that to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when MEPE_ELIG_IND="Y" then MEME_LAST_NAME else Null end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I thought I'd be clever and just come up with something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro iif(condition,true,else);
case when &amp;amp;condition then &amp;amp;true else &amp;amp;else end
%mend iif;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, of course, SAS considers&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;STRONG&gt;MEPE_ELIG_IND="Y"&lt;/STRONG&gt; to be passing a value to the macro variable&amp;nbsp;&lt;STRONG&gt;MEPE_ELIG_IND&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;instead of a whole value for variable &amp;amp;condition.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Just wondered if anybody had ideas for this.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595366#M171251</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-10-10T13:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595371#M171255</link>
      <description>&lt;P&gt;Either include the parameter name in the call:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%IIf(CONDITION=MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add parentheses around the condition.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%IIf((MEPE_ELIG_IND="Y"),MEME_LAST_NAME,Null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or both.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595371#M171255</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T13:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595372#M171256</link>
      <description>&lt;P&gt;Why not just use the IFN() or IFC() functions instead of making a macro?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595372#M171256</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T13:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595378#M171260</link>
      <description>&lt;P&gt;Since&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%IIf(MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;takes longer to write than&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ifc(MEPE_ELIG_IND="Y",MEME_LAST_NAME,"")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I really see no value in creating a macro.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595378#M171260</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-10T13:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595436#M171295</link>
      <description>Doh!  That did the trick!  Thanks so very much!</description>
      <pubDate>Thu, 10 Oct 2019 15:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595436#M171295</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-10-10T15:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert MS Access iif to macro %iif</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595519#M171337</link>
      <description>And if I'd remembered IFC I wouldn't have posted the question.  No value indeed.</description>
      <pubDate>Thu, 10 Oct 2019 17:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-MS-Access-iif-to-macro-iif/m-p/595519#M171337</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-10-10T17:41:15Z</dc:date>
    </item>
  </channel>
</rss>

