<?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: Macro Variable Not Being Resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-Not-Being-Resolved/m-p/118235#M293220</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need a "%global WhereClause;" in your macro else the macro variable has a scope of Local.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Oct 2013 06:05:41 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2013-10-21T06:05:41Z</dc:date>
    <item>
      <title>Macro Variable Not Being Resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-Not-Being-Resolved/m-p/118234#M293219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While looking forward to modify and refine a former code I made a variable to be declared on conditions in the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;====&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET Approach = 'CONTINUOUS';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET YrBeg = 2007;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET YrEnd = 2013;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET MnBeg = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET MnEnd = 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET MajDB = FAQ_NF.ConsNFData;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET WhereClauseA = MIS_MONTH BETWEEN MDY(&amp;amp;MnBeg,1,&amp;amp;YrBeg) AND INTNX("MONTH",MDY(&amp;amp;MnEnd,1,&amp;amp;YrEnd),0,"END");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET WhereClauseB = (YEAR(MIS_MONTH) = 2007 AND MONTH(MIS_MONTH) = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; OR (YEAR(MIS_MONTH) = 2008 AND MONTH(MIS_MONTH) = 9);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%LET WhereClauseC = AND ((UPPER(PRODUCT) = "AUTOS") AND (UPPER(PRODUCT_DESC) = "CAF")) OR &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ((UPPER(PRODUCT) = "AUTOS") AND (UPPER(PRODUCT_DESC) NE "CAF")) OR (UPPER(PRODUCT) = "SBL") OR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; (UPPER(PRODUCT) = "PIL") OR (UPPER(PRODUCT) = "SECURED") OR (UPPER(PRODUCT) = "UNSECURED");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;LIBNAME FAQ_NF 'F:\eLab\SAS_Experiments\FAQ2';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%MACRO ForWhereCl;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %IF &amp;amp;Approach = 'CONTINUOUS' %THEN %LET WhereClause = WHERE &amp;amp;WhereClauseA &amp;amp;WhereClauseC;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %ELSE %LET &lt;STRONG style="color: #808000; text-decoration: underline; font-family: 'courier new', courier;"&gt;WhereClause&lt;/STRONG&gt; = WHERE &amp;amp;WhereClauseB &amp;amp;WhereClauseC;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%MEND;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%ForWhereCl;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;PROC SQL;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; CREATE TABLE NET_FLOWS AS SELECT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MIS_MONTH,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PRODUCT,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PRODUCT_DESC,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SUM(POS)/1000 AS TOTAL_OS,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; COUNT(POS) AS COUNT_OS,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; FROM &amp;amp;MajDB&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808000;"&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808000;"&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808000; text-decoration: underline;"&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;amp;WhereClause&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; GROUP BY&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MIS_MONTH,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PRODUCT,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PRODUCT_DESC;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;====&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However when I run it the warning &lt;EM&gt;&lt;STRONG&gt;Apparent symbolic reference WHERECLAUSE not resolved.&lt;/STRONG&gt;&lt;/EM&gt; is faced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion and advice in this regard shall be highly obliged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 05:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-Not-Being-Resolved/m-p/118234#M293219</guid>
      <dc:creator>FarazA_Qureshi</dc:creator>
      <dc:date>2013-10-21T05:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable Not Being Resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-Not-Being-Resolved/m-p/118235#M293220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need a "%global WhereClause;" in your macro else the macro variable has a scope of Local.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 06:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-Not-Being-Resolved/m-p/118235#M293220</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-10-21T06:05:41Z</dc:date>
    </item>
  </channel>
</rss>

