<?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 check in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88076#M18800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin - I added option &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;mindelimiter&lt;/SPAN&gt; and it is still no working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Mar 2013 21:34:59 GMT</pubDate>
    <dc:creator>vicky07</dc:creator>
    <dc:date>2013-03-25T21:34:59Z</dc:date>
    <item>
      <title>Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88069#M18793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fairly new to Macro and I am struggling with the below simple code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Let ak =&amp;nbsp; abd2001;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Macro year;&lt;/P&gt;&lt;P&gt;%If &amp;amp;ak = %str(abd2001) %then&lt;/P&gt;&lt;P&gt; %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %Put &amp;amp;ak.;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%Mend;&lt;/P&gt;&lt;P&gt;%year;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code works fine,but i want to run the same macro for a different macro variable, let's say abd2005 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Let ak =&amp;nbsp; abd2005;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Macro year;&lt;/P&gt;&lt;P&gt;%If &amp;amp;ak in %str(abd2001,abd2005) %then&lt;/P&gt;&lt;P&gt; %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %Put &amp;amp;ak.;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%Mend;&lt;/P&gt;&lt;P&gt;%year;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting error now. Like i said I am new to macro and just learning. Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88069#M18793</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-25T17:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88070#M18794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try adding:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;options minoperater;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have sas 9.2 or higher&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88070#M18794</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-03-25T17:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88071#M18795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin - Added the option you suggested and i am not getting any error this time but the macro condition is saying False, even though the parameter that i passed is abd2005..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 18:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88071#M18795</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-25T18:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88072#M18796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace --&lt;/P&gt;&lt;P&gt;%If &amp;amp;ak in %str(abd2001,abd2005)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%If &amp;amp;ak in (abd2001,abd2005)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note - %str is used to mask commas,% etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 18:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88072#M18796</guid>
      <dc:creator>Ankitsas</dc:creator>
      <dc:date>2013-03-25T18:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88073#M18797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ankitsas - I need the %str as some of the variables that input has commas. But on a side note, I tried without the %str and it still didn't work. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 19:43:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88073#M18797</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-25T19:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88074#M18798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;options minoperator mindelimiter=',';&lt;/P&gt;&lt;P&gt;%Let ak =&amp;nbsp; abd2005;&lt;/P&gt;&lt;P&gt;%Macro year;&lt;/P&gt;&lt;P&gt;%If &amp;amp;ak in %str(abd2001,abd2005) %then&lt;/P&gt;&lt;P&gt;%do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %Put &amp;amp;ak.;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%Mend;&lt;/P&gt;&lt;P&gt;%year;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 19:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88074#M18798</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-03-25T19:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88075#M18799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you have seen, the IN operator in macro language is not as simple as the DATA step IN operator.&amp;nbsp; Given that you are new to macro language, I would recommend starting somewhere else.&amp;nbsp; Fow now, you could just spell out the values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;ak=adb2001 or &amp;amp;ak=adb2005 %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even that simple-looking syntax can become complicated, depending on the range of values that &amp;amp;AK can take on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88075#M18799</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-03-25T20:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88076#M18800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin - I added option &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;mindelimiter&lt;/SPAN&gt; and it is still no working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 21:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88076#M18800</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-25T21:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88077#M18801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Astounding, &lt;/P&gt;&lt;P&gt;It worked, thx, but the thing is I have more than 20 range of values that ak can take(just mentioned 2 for illustration purpose) and wondering if there is a more efficient way of doing this rather than listing all 20 variable with a OR in between.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 21:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88077#M18801</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-25T21:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88078#M18802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you saying that values of AK will have commas? If so you probably want to use a mindelimiter other than comma because otherwise the IN operator will examine each comma delimited string to the value of AK and never find a match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example if AK = abd2001,abd2005 and you are using IN (abd2001, abd2005) then AK is compared to abd2001 and is not match, then AK is compared to abd2005 and is not a match, so no match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to use a charcter for the delimiter that will not ever appear in AK to have this work as intended.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 21:41:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88078#M18802</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-03-25T21:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88079#M18803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It works for me. below is my log file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; options minoperator mindelimiter=',';&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; %Let ak =&amp;nbsp; abd2005;&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; %Macro year;&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %If &amp;amp;ak in %str(abd2001,abd2005) %then&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; %do;&lt;/P&gt;&lt;P&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %Put &amp;amp;ak.;&lt;/P&gt;&lt;P&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp; %Mend;&lt;/P&gt;&lt;P&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp; %year;&lt;/P&gt;&lt;P&gt;abd2005&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 23:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88079#M18803</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-03-25T23:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88080#M18804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works now. I had a typo in my code. TY!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2013 03:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88080#M18804</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2013-03-26T03:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88081#M18805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see also The Answer supplied by a Little Birdie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/MINDELIMITER_Macro_In_Delimiter" title="http://www.sascommunity.org/wiki/MINDELIMITER_Macro_In_Delimiter"&gt;http://www.sascommunity.org/wiki/MINDELIMITER_Macro_In_Delimiter&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; in.tu.it maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 15:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-check/m-p/88081#M18805</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-03-28T15:19:01Z</dc:date>
    </item>
  </channel>
</rss>

