<?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: SAS MACRO - Index to find the string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306858#M270585</link>
    <description>&lt;P&gt;I need to do this code in macro as i have to refer them at different part of the code to update the tables.&lt;BR /&gt;&lt;BR /&gt;%LET FIND_MATH = %INDEX(&amp;amp;FILENAME,'MATH') ;&lt;BR /&gt;%IF %eval(&amp;amp;FIND_MATH) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %LET TEXT = 'MATHS' ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %LET MyTable = MATH_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;%LET FIND_SCIENCE = %INDEX(&amp;amp;FILENAME,'SCIENCE');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %IF %eval(&amp;amp;FIND_SCIENCE) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET TEXT = 'SCIENCE';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %LET MyTable = SCIENCE_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;%LET FIND_GEOGRAPHY = %INDEX(&amp;amp;FILENAME,"GEOGRAPHY");&lt;BR /&gt;%IF %eval(&amp;amp;FIND_GEOGRAPHY) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;%LET TEXT = 'GEOGRAPHY';&lt;BR /&gt;%LET MyTable = GEOGRAPHY_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;ETC ( ALL THE SUBJECTS SHOULD BE SERACHED &amp;amp; i HAVE TO GO TO THE TABLE TO UPDATE IT AT LATER POINT OF THE CODE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR - &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am passing MATH_TEXT.xlsx as FILENAME in the macro&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MLOGIC(TEXT_BOOKS): %IF condition %eval(&amp;amp;FIND_MATH) &amp;gt; 0 is FALSE&lt;BR /&gt;MLOGIC(T&lt;SPAN&gt;EXT_BOOKS)&lt;/SPAN&gt;: %PUT &lt;SPAN&gt;TEXT&lt;/SPAN&gt;=&amp;amp;&lt;SPAN&gt;TEXT&lt;/SPAN&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference &lt;SPAN&gt;TEXT&lt;/SPAN&gt; not resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2016 15:56:54 GMT</pubDate>
    <dc:creator>SASAna</dc:creator>
    <dc:date>2016-10-24T15:56:54Z</dc:date>
    <item>
      <title>SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306787#M270576</link>
      <description>&lt;P&gt;I am writing a macro and trying to find the string using INDEX function from a parameter that is being passed in the macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if FILENAME is 'FILENAME_ABC' &amp;nbsp; , FIND_ABC is resolving it to 1 but if condition is telling true for all the conditions and name &amp;amp; Lastname is showing wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO XYZ(FILENAME);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%LET FIND_ABC = INDEX(&amp;amp;FILENAME,'ABC') ;&lt;BR /&gt;%IF FIND_ABC &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= 'ABC' ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = 'XYZ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%LET FIND_MNB = INDEX(&amp;amp;FILENAME,'MNB') ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%IF FIND_MNB&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;gt; 0 %THEN %DO;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= 'MNB' ; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = 'TRY';&lt;/SPAN&gt;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MEND(FILENAME);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306787#M270576</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-10-24T14:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306801#M270577</link>
      <description>&lt;P&gt;you have a mismatch of macro programming with data step programming..&lt;/P&gt;
&lt;P&gt;Your code with slight changes should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO XYZ(FILENAME);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%LET FIND_ABC = &lt;STRONG&gt;%&lt;/STRONG&gt;INDEX(&amp;amp;FILENAME,'ABC') ;&lt;BR /&gt;%IF &lt;STRONG&gt;%eval(&lt;/STRONG&gt;&amp;amp;FIND_ABC&lt;STRONG&gt;)&lt;/STRONG&gt; &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= 'ABC' ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = 'XYZ';&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;%END;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%LET FIND_MNB = &lt;STRONG&gt;%&lt;/STRONG&gt;INDEX(&amp;amp;FILENAME,'MNB') ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%IF %eval(&amp;amp;FIND_MNB&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;) &amp;gt; 0 %THEN %DO;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= 'MNB' ; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = 'TRY';&lt;/SPAN&gt;&lt;BR /&gt;%END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MEND(FILENAME);&lt;/P&gt;
&lt;P&gt;%PUT name=&amp;amp;name lastname=&amp;amp;lastname;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306801#M270577</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-24T14:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306803#M270578</link>
      <description>&lt;P&gt;These lines of code&lt;/P&gt;
&lt;P&gt;%IF FIND_ABC &amp;gt; 0 %THEN %DO;&lt;/P&gt;
&lt;P&gt;FIND_MNB&lt;SPAN&gt;&amp;nbsp;&amp;gt; 0 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;are comparing the actual text FIND_ABC to 0 since F is "greater than 0" (follows 0 in the sort sequence0 the result is true or 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to compare the VALUE of the macro variable then you want to use &amp;amp; to tell the processor to use the macro variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%IF &amp;amp;FIND_ABC &amp;gt; 0 %THEN %DO;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hover FIND_abc has the value of "Index(&amp;amp;filename,'ABC')", not 1 or something else. If you want Find_ABC to have the position of ABC in the value &amp;amp;filename then you want to use the MACRO fuction %index not the datastep function Index.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;%LET FIND_ABC = INDEX(&amp;amp;FILENAME,'ABC') ;&lt;/P&gt;
&lt;P&gt;%IF &amp;amp;FIND_ABC &amp;gt; 0 %THEN %DO;&lt;/P&gt;
&lt;P&gt;You are also likely missing and %end statement for the %if &amp;amp;find_abc&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306803#M270578</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-24T14:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306804#M270579</link>
      <description>&lt;P&gt;You cannot use data step functions in macro language without wrapping them in %sysfunc, so&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%xyz(xxx);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;would execute this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET FIND_ABC = INDEX(xxx,'ABC') ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put "&amp;amp;find_abc";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you would get&lt;/P&gt;
&lt;PRE&gt;"INDEX(xxx,'ABC')"&lt;/PRE&gt;
&lt;P&gt;in the log.&lt;/P&gt;
&lt;P&gt;Next, you omitted the ampersand to address macro variables, so&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%IF FIND_ABC &amp;gt; 0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;compares the &lt;U&gt;text&lt;/U&gt; "FIND_ABC" with the &lt;U&gt;text&lt;/U&gt; "0", which is always true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind: the macro processor is a pure &lt;STRONG&gt;&lt;U&gt;text&lt;/U&gt;&lt;/STRONG&gt; processor, intended mostly to create &lt;U&gt;dynamic program text&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to manipulate strings, do so in a data step, and save the results to macro variables with call symput if needed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro xyz(filename);
%global name lastname;
data _null_;
if index("&amp;amp;filename",'ABC') &amp;gt; 0
then do;
  call symput('name','ABC');
  call symput('lastname','XYZ');
end;
if index("&amp;amp;filename",'MNB') &amp;gt; 0
then do;
  call symput('name','MNB');
  call symput('lastname','TRY');
end;
run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306804#M270579</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-24T14:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306817#M270580</link>
      <description>I am getting this error&lt;BR /&gt;"ERROR: Required operator not found in expression: INDEX('ABC_test.xlsx','ABC')</description>
      <pubDate>Mon, 24 Oct 2016 14:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306817#M270580</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-10-24T14:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306818#M270581</link>
      <description>&lt;P&gt;Why do you need to do it in a macro? &amp;nbsp;Macro language Only creates Base SAS code, so why not use Base SAS in the first place? &amp;nbsp;Also, please avoid coding all in upper case, it makes reading the code sound like your shouting it at me.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306818#M270581</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-24T14:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306822#M270582</link>
      <description>Sorry, error was different .&lt;BR /&gt;&lt;BR /&gt;SYMBOLGEN: Macro variable FIND_ABC resolves to 0&lt;BR /&gt;MLOGIC(XYZ): %IF condition %eval(&amp;amp;FIND_ABC) &amp;gt; 0 is FALSE&lt;BR /&gt;MLOGIC(XYZ): %PUT NAME=&amp;amp;NAME&lt;BR /&gt;WARNING: Apparent symbolic reference NAME not resolved.&lt;BR /&gt;NAME=&amp;amp;NAME</description>
      <pubDate>Mon, 24 Oct 2016 14:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306822#M270582</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-10-24T14:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306823#M270583</link>
      <description>&lt;P&gt;Post the complete step code &amp;amp; log; because this works:&lt;/P&gt;
&lt;PRE&gt;16         data _null_;
17         x1 = INDEX('ABC_test.xlsx','ABC');
18         put x1=;
19         run;

x1=1
&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306823#M270583</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-24T14:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306834#M270584</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86567"&gt;@SASAna&lt;/a&gt; wrote:&lt;BR /&gt;Sorry, error was different .&lt;BR /&gt;&lt;BR /&gt;SYMBOLGEN: Macro variable FIND_ABC resolves to 0&lt;BR /&gt;MLOGIC(XYZ): %IF condition %eval(&amp;amp;FIND_ABC) &amp;gt; 0 is FALSE&lt;BR /&gt;MLOGIC(XYZ): %PUT NAME=&amp;amp;NAME&lt;BR /&gt;WARNING: Apparent symbolic reference NAME not resolved.&lt;BR /&gt;NAME=&amp;amp;NAME&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You also need to show the code that is supposed to set the macro variable &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;name&lt;/FONT&gt;&lt;/STRONG&gt;, as the error is most probably there.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 15:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306834#M270584</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-24T15:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306858#M270585</link>
      <description>&lt;P&gt;I need to do this code in macro as i have to refer them at different part of the code to update the tables.&lt;BR /&gt;&lt;BR /&gt;%LET FIND_MATH = %INDEX(&amp;amp;FILENAME,'MATH') ;&lt;BR /&gt;%IF %eval(&amp;amp;FIND_MATH) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %LET TEXT = 'MATHS' ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %LET MyTable = MATH_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;%LET FIND_SCIENCE = %INDEX(&amp;amp;FILENAME,'SCIENCE');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %IF %eval(&amp;amp;FIND_SCIENCE) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET TEXT = 'SCIENCE';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %LET MyTable = SCIENCE_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;%LET FIND_GEOGRAPHY = %INDEX(&amp;amp;FILENAME,"GEOGRAPHY");&lt;BR /&gt;%IF %eval(&amp;amp;FIND_GEOGRAPHY) &amp;gt; 0 %THEN %DO;&lt;BR /&gt;%LET TEXT = 'GEOGRAPHY';&lt;BR /&gt;%LET MyTable = GEOGRAPHY_TABLE;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;ETC ( ALL THE SUBJECTS SHOULD BE SERACHED &amp;amp; i HAVE TO GO TO THE TABLE TO UPDATE IT AT LATER POINT OF THE CODE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR - &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am passing MATH_TEXT.xlsx as FILENAME in the macro&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MLOGIC(TEXT_BOOKS): %IF condition %eval(&amp;amp;FIND_MATH) &amp;gt; 0 is FALSE&lt;BR /&gt;MLOGIC(T&lt;SPAN&gt;EXT_BOOKS)&lt;/SPAN&gt;: %PUT &lt;SPAN&gt;TEXT&lt;/SPAN&gt;=&amp;amp;&lt;SPAN&gt;TEXT&lt;/SPAN&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference &lt;SPAN&gt;TEXT&lt;/SPAN&gt; not resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 15:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306858#M270585</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-10-24T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306907#M270586</link>
      <description>&lt;P&gt;In a macro program you do not need to quote the strings (I missed it in my previous post);&lt;/P&gt;
&lt;P&gt;You also missed some syntax defining and using a macro program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%MACRO XYZ&lt;/STRONG&gt;(FILENAME);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%LET FIND_ABC = &lt;STRONG&gt;%&lt;/STRONG&gt;INDEX(&amp;amp;FILENAME,ABC) ;&lt;BR /&gt;%IF &lt;STRONG&gt;%eval(&lt;/STRONG&gt;&amp;amp;FIND_ABC&lt;STRONG&gt;)&lt;/STRONG&gt; &amp;gt; 0 %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= ABC ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = XYZ;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;%END;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%PUT (1) name=&amp;amp;name lastname=&amp;amp;lastname;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%LET FIND_MNB = &lt;STRONG&gt;%&lt;/STRONG&gt;INDEX(&amp;amp;FILENAME,MNB) ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%IF %eval(&amp;amp;FIND_MNB&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;) &amp;gt; 0 %THEN %DO;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET NAME= MNB; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%LET LASTname = TRY;&lt;/SPAN&gt;&lt;BR /&gt;%END;&lt;/P&gt;
&lt;P&gt;%PUT (2) name=&amp;amp;name lastname=&amp;amp;lastname;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%MEND XYZ&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%XYZ&lt;/STRONG&gt;(FILENAME);&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%PUT (3) name=&amp;amp;name lastname=&amp;amp;lastname;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using same macro variables names twice will end by the last only.&lt;/P&gt;
&lt;P&gt;How do you want to refer the macro variables later ? -&lt;/P&gt;
&lt;P&gt;Log message (3) equals to (2), and you miss the (1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 18:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306907#M270586</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-24T18:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO - Index to find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306976#M270587</link>
      <description>Worked perfect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I added a macro for all the true conditions to continue my SAS analysis.&lt;BR /&gt;&lt;BR /&gt;Thank you .&lt;BR /&gt;Ana</description>
      <pubDate>Mon, 24 Oct 2016 21:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-Index-to-find-the-string/m-p/306976#M270587</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-10-24T21:54:08Z</dc:date>
    </item>
  </channel>
</rss>

