<?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: How to fix All positional parameters must precede keyword parameters error? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720184#M223069</link>
    <description>Thankk you. It works but how can I apply it in&lt;BR /&gt;call execute(cats('%nrstr(%%raw)(',Data,',',WHERE_FILTER1,',',WHERE_FILTER2,')'));&lt;BR /&gt;this code?</description>
    <pubDate>Thu, 18 Feb 2021 14:17:04 GMT</pubDate>
    <dc:creator>orangejuss</dc:creator>
    <dc:date>2021-02-18T14:17:04Z</dc:date>
    <item>
      <title>How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720176#M223065</link>
      <description>&lt;P&gt;I have a macro named raw and first it checks data existence, then if exist it creates new data from it using given filters. And it reads datanames and filters from a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro raw(data,where_filter1,where_filter2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(raw_&amp;amp;data)) %then %do;&lt;BR /&gt;data new_&amp;amp;data;&lt;BR /&gt;set raw_&amp;amp;data;&lt;BR /&gt;if &amp;amp;where_filter;&lt;BR /&gt;run;&lt;BR /&gt;/*code continues*/&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file print;&lt;BR /&gt;put 'Data set raw_&amp;amp;data does not exist';&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%raw(Data2,name='john' and id='KN30' and num&amp;gt;10,sum&amp;gt;100 and id='xyz');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALL EXECUTE("%raw("||Data||","||where_filter1||","||where_filter2||");");&lt;/P&gt;&lt;P&gt;if I run the code like this; it does not check table existence correctly. Always gives else do result.&amp;nbsp;'Data set raw_&amp;amp;data does not exist'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;call execute(cats('%nrstr(%%raw)(',Data,',',WHERE_FILTER1,',',WHERE_FILTER2,')'));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if I run like this it checks table existence correctly,&lt;BR /&gt;but gives ERROR: All positional parameters must precede keyword parameters. Because of where_filter1 and where_filter2 parameters includes quotes and &amp;gt; &amp;lt; characters&amp;nbsp; it doesn't work correctly. How can I fix that? Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 13:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720176#M223065</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2021-02-18T13:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720179#M223067</link>
      <description>&lt;P&gt;The equal sign in your where filters makes SAS think you are using a keyword parameter. SAS doesn't know the equal sign is supposed to be used in a DATA step. So to fix this, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%raw(Data2,%str(name='john' and id='KN30' and num&amp;gt;10), %str(sum&amp;gt;100 and id='xyz'))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 13:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720179#M223067</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T13:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720184#M223069</link>
      <description>Thankk you. It works but how can I apply it in&lt;BR /&gt;call execute(cats('%nrstr(%%raw)(',Data,',',WHERE_FILTER1,',',WHERE_FILTER2,')'));&lt;BR /&gt;this code?</description>
      <pubDate>Thu, 18 Feb 2021 14:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720184#M223069</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2021-02-18T14:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720190#M223073</link>
      <description>&lt;P&gt;You would need to add %str( and a right parenthesis ) in the proper places in the CALL EXECUTE statement.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720190#M223073</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T14:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720221#M223094</link>
      <description>I tried to write an example code:&lt;BR /&gt;data sample;input table_name $6. filter $30. ;DATALINES;Table1 name='DEF' and sum&amp;gt;=20Table2 sum&amp;gt;=100;RUN;&lt;BR /&gt;data raw_table1;input id $6. sum name $5.;DATALINES;a10300 40 ABCb10300 20 DEFc10300 10 XYZ;RUN;&lt;BR /&gt;&lt;BR /&gt;%macro raw(data,where_filter);&lt;BR /&gt;%if %sysfunc(exist(raw_&amp;amp;data)) %then %do;data new_&amp;amp;data;set raw_&amp;amp;data;if &amp;amp;where_filter;run;/*code continues*/%end;%else %do;data _null_;file print;put 'Data set raw_&amp;amp;data does not exist';run;%end;%MEND;&amp;nbsp;DATA&amp;nbsp; _NULL_;&amp;nbsp;SET SAMPLE;&amp;nbsp;call execute(cats('%nrstr(%%raw)(',%str(Table_name),',',%str(filter),')'));&amp;nbsp;RUN;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720221#M223094</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2021-02-18T15:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720233#M223102</link>
      <description>&lt;P&gt;Sorry, but I no longer try to decipher poorly formatted code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please paste your code into the window that appears when you click on the little running man icon, and format it so that its not very long unreadable lines and so that there is one SAS command on a line.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720233#M223102</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T16:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720240#M223108</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;I tried to write an example code:

data sample;
input table_name $6. filter $30. ;
DATALINES;
Table1 name='DEF' and sum&amp;gt;=20
Table2 sum&amp;gt;=100
;
RUN;

data raw_table1;
input id $6. sum name $5.;
DATALINES;
a10300 40 ABC
b10300 20 DEF
c10300 10 XYZ
;
RUN;


%macro raw(data,where_filter);

%if %sysfunc(exist(raw_&amp;amp;data)) %then %do;
data new_&amp;amp;data;
set raw_&amp;amp;data;
if &amp;amp;where_filter;
run;
/*code continues*/
%end;
%else %do;
data _null_;
file print;
put 'Data set raw_&amp;amp;data does not exist';
run;
%end;
%MEND;
 DATA  _NULL_;
 SET SAMPLE;
 call execute(cats('%nrstr(%%raw)(',%str(Table_name),',',%str(filter),')'));
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;Sorry, I replied to this by email, I did not notice that the code looked bad.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720240#M223108</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2021-02-18T16:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix All positional parameters must precede keyword parameters error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720254#M223110</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; call execute(cats('%nrstr(%raw(',Table_name,',%str(',filter,')))'));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fix-All-positional-parameters-must-precede-keyword/m-p/720254#M223110</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T16:36:18Z</dc:date>
    </item>
  </channel>
</rss>

