<?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 Replacing * with % in a string results in a warning in the log in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283712#M57832</link>
    <description>&lt;P&gt;I am trying to replace * with % in a string and than build a SQL like statement. Replacing it with tranwrd works perfect and can even use a macro variable to build the like statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only problem&amp;nbsp;I have is that I get a warning in the log :&lt;/P&gt;
&lt;P&gt;WARNING: Apparent invocation of macro G not resolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is obviously because of the % replacement. I tried several hiding statements but i cant get rit of the warning. Using the macro variable in the SQL statement works also perfect as you can see in the enclosed code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;OPTIONS MPRINT NOMLOGIC NOSYMBOLGEN source source2;
%MACRO multi_selection(p_variabele=,p_type=);
  %GLOBAL &amp;amp;p_variabele;
  %GLOBAL &amp;amp;p_variabele._zonder;
  %GLOBAL &amp;amp;p_variabele._sql;

  %LET v_scheiding=;
  %IF &amp;amp;p_type=txt %THEN %LET v_scheiding=%STR(%");
  %if &amp;amp;&amp;amp;&amp;amp;p_variabele._count=1 %THEN
     %DO;
        %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele.;
        %LET &amp;amp;p_variabele=&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;v_scheiding.;
        %LET test=&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder;
        %IF %SYSFUNC(FIND(&amp;amp;&amp;amp;&amp;amp;p_variabele.,*)) &amp;gt; 0 %THEN 
          %DO; 
             DATA _NULL_;
               test1="%SYSFUNC(TRANWRD(&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder,*,%))"; 
               test="LIKE '" || test1 || "'";
               CALL SYMPUT("&amp;amp;p_variabele._sql",test);
             RUN;
          %END;
     %END;
  %else   
     %DO;
     %LET &amp;amp;p_variabele=;
     %do i=1 %to &amp;amp;&amp;amp;&amp;amp;p_variabele._COUNT;
        %IF &amp;amp;i=1 %THEN
          %DO;
            %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i;          
            %LET &amp;amp;p_variabele=&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.&amp;amp;v_scheiding.;
          %END;
        %ELSE
          %DO;
            %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder.,&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.;        
            %LET &amp;amp;p_variabele=&amp;amp;&amp;amp;&amp;amp;p_variabele.,&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.&amp;amp;v_scheiding.;
          %END;
     %END; 
     %END;
     
  %PUT &amp;amp;&amp;amp;p_variabele._zonder: &amp;amp;&amp;amp;&amp;amp;p_variabele._zonder;
  %PUT &amp;amp;&amp;amp;p_variabele.: &amp;amp;&amp;amp;&amp;amp;p_variabele.;
  %PUT &amp;amp;&amp;amp;p_variabele._sql:  &amp;amp;&amp;amp;&amp;amp;p_variabele._sql;
%MEND;

%LET test_sql=;
%LET test_count=1;
%LET test=*g*;

%multi_selection(P_variabele=test,p_type=txt);

DATA work.test;
  txt_field="aabbd";
  output;
  txt_field="agod";
  output;
  txt_field="g987b";
  output;
  txt_field="987bg";
  output;
RUN;

PROC SQL;
  CREATE TABLE work.test1
  AS
  SELECT
    *
  FROM
    work.test
  WHERE 
    txt_field &amp;amp;test_sql.;
QUIT;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Jul 2016 08:47:05 GMT</pubDate>
    <dc:creator>Richardvan_tHoff</dc:creator>
    <dc:date>2016-07-12T08:47:05Z</dc:date>
    <item>
      <title>Replacing * with % in a string results in a warning in the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283712#M57832</link>
      <description>&lt;P&gt;I am trying to replace * with % in a string and than build a SQL like statement. Replacing it with tranwrd works perfect and can even use a macro variable to build the like statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only problem&amp;nbsp;I have is that I get a warning in the log :&lt;/P&gt;
&lt;P&gt;WARNING: Apparent invocation of macro G not resolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is obviously because of the % replacement. I tried several hiding statements but i cant get rit of the warning. Using the macro variable in the SQL statement works also perfect as you can see in the enclosed code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;OPTIONS MPRINT NOMLOGIC NOSYMBOLGEN source source2;
%MACRO multi_selection(p_variabele=,p_type=);
  %GLOBAL &amp;amp;p_variabele;
  %GLOBAL &amp;amp;p_variabele._zonder;
  %GLOBAL &amp;amp;p_variabele._sql;

  %LET v_scheiding=;
  %IF &amp;amp;p_type=txt %THEN %LET v_scheiding=%STR(%");
  %if &amp;amp;&amp;amp;&amp;amp;p_variabele._count=1 %THEN
     %DO;
        %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele.;
        %LET &amp;amp;p_variabele=&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;v_scheiding.;
        %LET test=&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder;
        %IF %SYSFUNC(FIND(&amp;amp;&amp;amp;&amp;amp;p_variabele.,*)) &amp;gt; 0 %THEN 
          %DO; 
             DATA _NULL_;
               test1="%SYSFUNC(TRANWRD(&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder,*,%))"; 
               test="LIKE '" || test1 || "'";
               CALL SYMPUT("&amp;amp;p_variabele._sql",test);
             RUN;
          %END;
     %END;
  %else   
     %DO;
     %LET &amp;amp;p_variabele=;
     %do i=1 %to &amp;amp;&amp;amp;&amp;amp;p_variabele._COUNT;
        %IF &amp;amp;i=1 %THEN
          %DO;
            %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i;          
            %LET &amp;amp;p_variabele=&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.&amp;amp;v_scheiding.;
          %END;
        %ELSE
          %DO;
            %LET &amp;amp;p_variabele._zonder=&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder.,&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.;        
            %LET &amp;amp;p_variabele=&amp;amp;&amp;amp;&amp;amp;p_variabele.,&amp;amp;v_scheiding.&amp;amp;&amp;amp;&amp;amp;p_variabele.&amp;amp;i.&amp;amp;v_scheiding.;
          %END;
     %END; 
     %END;
     
  %PUT &amp;amp;&amp;amp;p_variabele._zonder: &amp;amp;&amp;amp;&amp;amp;p_variabele._zonder;
  %PUT &amp;amp;&amp;amp;p_variabele.: &amp;amp;&amp;amp;&amp;amp;p_variabele.;
  %PUT &amp;amp;&amp;amp;p_variabele._sql:  &amp;amp;&amp;amp;&amp;amp;p_variabele._sql;
%MEND;

%LET test_sql=;
%LET test_count=1;
%LET test=*g*;

%multi_selection(P_variabele=test,p_type=txt);

DATA work.test;
  txt_field="aabbd";
  output;
  txt_field="agod";
  output;
  txt_field="g987b";
  output;
  txt_field="987bg";
  output;
RUN;

PROC SQL;
  CREATE TABLE work.test1
  AS
  SELECT
    *
  FROM
    work.test
  WHERE 
    txt_field &amp;amp;test_sql.;
QUIT;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2016 08:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283712#M57832</guid>
      <dc:creator>Richardvan_tHoff</dc:creator>
      <dc:date>2016-07-12T08:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing * with % in a string results in a warning in the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283716#M57833</link>
      <description>&lt;P&gt;You don't need %SYSFUNC in Data Step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
               *test1='%SYSFUNC(TRANWRD(&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder,*,%))'; 
               test1=TRANWRD("&amp;amp;&amp;amp;&amp;amp;p_variabele._zonder",'*','%');
               test="LIKE '" ||strip(test1)|| "'";
               CALL SYMPUT("&amp;amp;p_variabele._sql",test);
             RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2016 09:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283716#M57833</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-12T09:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing * with % in a string results in a warning in the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283728#M57835</link>
      <description>&lt;P&gt;THx. that worked and you are correct you don't need sysfunc in a data step.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 10:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-with-in-a-string-results-in-a-warning-in-the-log/m-p/283728#M57835</guid>
      <dc:creator>Richardvan_tHoff</dc:creator>
      <dc:date>2016-07-12T10:18:46Z</dc:date>
    </item>
  </channel>
</rss>

