<?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 call execute problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654458#M196525</link>
    <description>&lt;P&gt;hi sas experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is my original script:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro sqlmerchant(name=,test=);&lt;BR /&gt;if &amp;amp;test then do;&lt;BR /&gt;Cleaned_flag="Y";&lt;BR /&gt;NAME="&amp;amp;name";&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;%mend sqlmerchant;&lt;BR /&gt;data TESTING2;&lt;BR /&gt;set TESTING;&lt;BR /&gt;format&lt;BR /&gt;name $CHAR255.;&lt;BR /&gt;%sqlmerchant(name=A BAKERY CHATERAISE, test=indexw(NEW,"A BAKERY CHATERAISE") &amp;amp; "Merchant Category"n in ("Miscellaneous Stores----Quick Payment Service-Fast Food Restaurants") );&lt;BR /&gt;%sqlmerchant(name=A BAKERY CHATERAISE, test=indexw(NEW,"A BAKERY CHATERAISE") &amp;amp; "Merchant Category"n in ("Retail Outlet Services----Bakeries") );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but i shorten my script by removing repeat marco&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so i build up a keyword inventory like this:&lt;/P&gt;
&lt;TABLE width="1918"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="309"&gt;final_name2&lt;/TD&gt;
&lt;TD width="1105"&gt;Merchant Category&lt;/TD&gt;
&lt;TD width="504"&gt;NEW_NAME2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Schools and Educational Services - Not Elsewhere Classified&lt;/TD&gt;
&lt;TD&gt;A A DRIVER TRAINING&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Opticians, Optical Goods and Eyeglasses&lt;/TD&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A OPTICAL YUEN LONG&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Opticians, Optical Goods and Eyeglasses&lt;/TD&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anyone help me to change it into this fore using call&amp;nbsp;execute?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro sqlmerchant(name=,test=);&lt;BR /&gt;if &amp;amp;test then do;&lt;BR /&gt;Cleaned_flag="Y";&lt;BR /&gt;NAME="&amp;amp;name";&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;%mend sqlmerchant;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data TESTING2;&lt;BR /&gt;set TESTING;&lt;BR /&gt;format&lt;BR /&gt;name $CHAR255.;&lt;BR /&gt;call execute('keyword2.'||strip(name)||';&lt;BR /&gt;set keyword2;&lt;BR /&gt;test=indexw(final_name2,'||strip(name)||') &amp;amp; "Merchant Category"n in ('||strip(name)||') );&lt;BR /&gt;run;');&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;harry&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2020 11:13:16 GMT</pubDate>
    <dc:creator>harrylui</dc:creator>
    <dc:date>2020-06-08T11:13:16Z</dc:date>
    <item>
      <title>call execute problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654458#M196525</link>
      <description>&lt;P&gt;hi sas experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is my original script:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro sqlmerchant(name=,test=);&lt;BR /&gt;if &amp;amp;test then do;&lt;BR /&gt;Cleaned_flag="Y";&lt;BR /&gt;NAME="&amp;amp;name";&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;%mend sqlmerchant;&lt;BR /&gt;data TESTING2;&lt;BR /&gt;set TESTING;&lt;BR /&gt;format&lt;BR /&gt;name $CHAR255.;&lt;BR /&gt;%sqlmerchant(name=A BAKERY CHATERAISE, test=indexw(NEW,"A BAKERY CHATERAISE") &amp;amp; "Merchant Category"n in ("Miscellaneous Stores----Quick Payment Service-Fast Food Restaurants") );&lt;BR /&gt;%sqlmerchant(name=A BAKERY CHATERAISE, test=indexw(NEW,"A BAKERY CHATERAISE") &amp;amp; "Merchant Category"n in ("Retail Outlet Services----Bakeries") );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but i shorten my script by removing repeat marco&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so i build up a keyword inventory like this:&lt;/P&gt;
&lt;TABLE width="1918"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="309"&gt;final_name2&lt;/TD&gt;
&lt;TD width="1105"&gt;Merchant Category&lt;/TD&gt;
&lt;TD width="504"&gt;NEW_NAME2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Schools and Educational Services - Not Elsewhere Classified&lt;/TD&gt;
&lt;TD&gt;A A DRIVER TRAINING&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Opticians, Optical Goods and Eyeglasses&lt;/TD&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A A OPTICAL YUEN LONG&lt;/TD&gt;
&lt;TD&gt;Professional Services and Membership Organizations----Opticians, Optical Goods and Eyeglasses&lt;/TD&gt;
&lt;TD&gt;A A OPTICAL HONG KONG&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anyone help me to change it into this fore using call&amp;nbsp;execute?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro sqlmerchant(name=,test=);&lt;BR /&gt;if &amp;amp;test then do;&lt;BR /&gt;Cleaned_flag="Y";&lt;BR /&gt;NAME="&amp;amp;name";&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;%mend sqlmerchant;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data TESTING2;&lt;BR /&gt;set TESTING;&lt;BR /&gt;format&lt;BR /&gt;name $CHAR255.;&lt;BR /&gt;call execute('keyword2.'||strip(name)||';&lt;BR /&gt;set keyword2;&lt;BR /&gt;test=indexw(final_name2,'||strip(name)||') &amp;amp; "Merchant Category"n in ('||strip(name)||') );&lt;BR /&gt;run;');&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;harry&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 11:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654458#M196525</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-06-08T11:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: call execute problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654478#M196531</link>
      <description>&lt;P&gt;Hello Harry,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Statements generated with CALL EXECUTE will only be executed AFTER the datastep that generates them is finished. Unlike macro statements that are executed BEFORE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you should elaborate a little more about what you are trying to accomplish , and perhaps pass along some sample data in a datastep cards statement so we can replicate what you are doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Mathias.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 11:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654478#M196531</guid>
      <dc:creator>MCoopmans</dc:creator>
      <dc:date>2020-06-08T11:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: call execute problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654498#M196538</link>
      <description>&lt;P&gt;From the looks of it you just want to create a new variable where you replace a very long string with a shorter string. If so then consider to create a format.&lt;/P&gt;
&lt;P&gt;If you also add an OTHER case to the format where the label is missing then you can also query the result and set your flag (set to Y if the new variable is not missing).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;name=put(have, $myformat.);&lt;/P&gt;
&lt;P&gt;if not missing(name) then&amp;nbsp;&lt;SPAN&gt;Cleaned_flag="Y";&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 12:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654498#M196538</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-08T12:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: call execute problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654535#M196549</link>
      <description>Any reason you didn't use arrays instead of a macro here?</description>
      <pubDate>Mon, 08 Jun 2020 14:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-problem/m-p/654535#M196549</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-08T14:09:40Z</dc:date>
    </item>
  </channel>
</rss>

