<?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 correct: ERROR: All positional parameters must precede keyword parameters. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294894#M270230</link>
    <description>&lt;P&gt;Yes, it's possible that you will have many errors to debug.&amp;nbsp; This first step was only to get the macro to run at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a way you can isolate the errors one at a time, so you can fix them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the bottom SELECT statements.&amp;nbsp; Get the first CONNECT/SELECT/DISCONNECT group to work.&amp;nbsp; You don't even need macro language to do this.&amp;nbsp; Just take the code out of the macro, and hard-code the NBIZ and BUSINESS_UNIT value(s).&amp;nbsp; Once that section of code is working, add in the next CONNECT/SELECT/DISCONNECT group.&amp;nbsp; By removing the macro language in order to debug, the error messages will become much clearer.&amp;nbsp; SAS will do a better job locating the source of the error.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2016 17:24:05 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-08-29T17:24:05Z</dc:date>
    <item>
      <title>How to correct: ERROR: All positional parameters must precede keyword parameters.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294853#M270227</link>
      <description>&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;Hi all,&lt;/P&gt;
&lt;P&gt;I’m having trouble getting the macro below to work.&amp;nbsp;&amp;nbsp; The run is fine for these first three passes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;prod&lt;/EM&gt;&lt;/STRONG&gt;(NBIZ=RLS, biz=&lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;prod&lt;/EM&gt;&lt;/STRONG&gt;(NBIZ=PFS, biz=&lt;STRONG&gt;2&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;prod&lt;/EM&gt;&lt;/STRONG&gt;(NBIZ=RLE, biz=&lt;STRONG&gt;3&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I’m running into an error when I try to run these two passes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;prod&lt;/EM&gt;&lt;/STRONG&gt;(NBIZ=CMUS, biz= &lt;STRONG&gt;4&lt;/STRONG&gt;,&lt;STRONG&gt;14&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;prod&lt;/EM&gt;&lt;/STRONG&gt;(NBIZ=CMCA, biz= &lt;STRONG&gt;5&lt;/STRONG&gt;,&lt;STRONG&gt;15&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %prod(NBIZ=CMUS, biz= 4,14);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ERROR: All positional parameters must precede keyword parameters.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;69&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %prod(NBIZ=CMCA, biz= 5,15);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ERROR: All positional parameters must precede keyword parameters.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having trouble figuring out how to correct this.&amp;nbsp; Any assistance will be greatly appreciated. &amp;nbsp;Thanks!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;BR /&gt;%macro prod (NBIZ=,biz=);&amp;nbsp;
proc sql;
drop table ora.&amp;amp;NBIZ._PRODL1;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table&amp;nbsp; ora.&amp;amp;NBIZ._PRODL1&amp;nbsp; as
select *
from connection to oracle (
SELECT DISTINCT business_unit,
&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN group_div = 999999 THEN group_div ELSE group_div || '0' || business_unit END AS group_div,
&amp;nbsp;&amp;nbsp;&amp;nbsp; group_div_desc
&amp;nbsp; FROM mbs.sas_sku_xref_vw
&amp;nbsp; WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table&amp;nbsp;&amp;nbsp; ora.&amp;amp;NBIZ._PRODL2&amp;nbsp; as
select *
from connection to oracle (
&amp;nbsp;select DISTINCT business_unit,
&amp;nbsp;&amp;nbsp;&amp;nbsp; case WHEN division = 999999 THEN division ELSE division || '0' || business_unit END AS division, division_desc
&amp;nbsp; from mbs.sas_sku_xref_vw
&amp;nbsp; WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table&amp;nbsp;&amp;nbsp; ora.&amp;amp;NBIZ._PRODL3&amp;nbsp; as
select *
from connection to oracle (
&amp;nbsp; SELECT DISTINCT business_unit,
&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN department = 999999 then&amp;nbsp; department else&amp;nbsp; department || '0' || business_unit end as department, department_desc
&amp;nbsp; FROM mbs.sas_sku_xref_vw
&amp;nbsp; WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table&amp;nbsp;&amp;nbsp; ora.&amp;amp;NBIZ._PRODL4&amp;nbsp; as
select *
from connection to oracle (
&amp;nbsp; SELECT DISTINCT business_unit,
&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN sub_department = 999999 THEN sub_department ELSE sub_department || '0' || business_unit END AS sub_department, sub_department_desc
&amp;nbsp; FROM mbs.sas_sku_xref_vw
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;nbsp; WHERE business_unit in (&amp;amp;biz.));&lt;/STRONG&gt;&lt;/FONT&gt;
disconnect from oracle;quit;
%mend;
%prod(NBIZ=RLS, biz=1);
%prod(NBIZ=PFS, biz=2);
%prod(NBIZ=RLE, biz=3);
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;%prod(NBIZ=CMUS, biz= 4,14);
%prod(NBIZ=CMCA, biz= 5,15);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294853#M270227</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2016-08-29T14:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to correct: ERROR: All positional parameters must precede keyword parameters.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294865#M270228</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's note:&amp;nbsp; This answer is correct but if you need the commas to be part of the value you would say:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp; %prod(nbiz=cmus, biz=%str(4,14))&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;The following is also a link to the macro documentation that discusses macro parameters that you might find helpful:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p1nypovnwon4uyn159rst8pgzqrl.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p1nypovnwon4uyn159rst8pgzqrl.htm&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you have seen, commas separate parameters when calling a macro.&amp;nbsp; Thus the commas that are NOT separating parameters cause confusion for macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simplest solution is to get rid of the extra commas in this case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;%prod(NBIZ=CMUS, biz= 4 14)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When substituted into the WHERE clause, the commas are optional.&amp;nbsp; So removing the commas won't hurt, and makes the macro calls simpler.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 17:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294865#M270228</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-30T17:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to correct: ERROR: All positional parameters must precede keyword parameters.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294884#M270229</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still could not seem to get the query to work after I remove the comma. &amp;nbsp; See the error below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ERROR: ORACLE prepare error: ORA-00907: missing right parenthesis. SQL statement: SELECT DISTINCT business_unit, CASE WHEN &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; group_div = 999999 THEN group_div ELSE group_div || '0' || business_unit END AS group_div, group_div_desc FROM &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; mbs.sas_sku_xref_vw WHERE business_unit in (&lt;FONT color="#FF0000"&gt;5 15&lt;/FONT&gt;).&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/STRONG&gt;&lt;BR /&gt;NOTE: Statement not executed due to NOEXEC option.&lt;BR /&gt;NOTE: Statement not executed due to NOEXEC option.&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;PRE&gt;%macro prod (NBIZ=,biz=); 
proc sql;
drop table ora.&amp;amp;NBIZ._PRODL1; 
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table ora.&amp;amp;NBIZ._PRODL1 as
select *
from connection to oracle (
SELECT DISTINCT business_unit,
CASE WHEN group_div = 999999 THEN group_div ELSE group_div || '0' || business_unit END AS group_div,
group_div_desc
FROM mbs.sas_sku_xref_vw
WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table ora.&amp;amp;NBIZ._PRODL2 as
select *
from connection to oracle (
select DISTINCT business_unit,
case WHEN division = 999999 THEN division ELSE division || '0' || business_unit END AS division, division_desc
from mbs.sas_sku_xref_vw
WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table ora.&amp;amp;NBIZ._PRODL3 as
select *
from connection to oracle (
SELECT DISTINCT business_unit,
CASE WHEN department = 999999 then department else department || '0' || business_unit end as department, department_desc
FROM mbs.sas_sku_xref_vw
WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;
connect to oracle (user=polodm password=polodm path='K6PPOLDM');
create table ora.&amp;amp;NBIZ._PRODL4 as
select *
from connection to oracle (
SELECT DISTINCT business_unit,
CASE WHEN sub_department = 999999 THEN sub_department ELSE sub_department || '0' || business_unit END AS sub_department, sub_department_desc
FROM mbs.sas_sku_xref_vw
WHERE business_unit in (&amp;amp;biz.));
disconnect from oracle;quit;
%mend;
%prod(NBIZ=RLS, biz=1);
%prod(NBIZ=PFS, biz=2);
%prod(NBIZ=RLE, biz=3);
&lt;STRONG&gt;%prod(NBIZ=CMUS, biz= &lt;FONT color="#FF0000"&gt;4 14&lt;/FONT&gt;);
%prod(NBIZ=CMCA, biz= &lt;FONT color="#FF0000"&gt;5 15&lt;/FONT&gt;);&lt;/STRONG&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 16:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294884#M270229</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2016-08-29T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to correct: ERROR: All positional parameters must precede keyword parameters.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294894#M270230</link>
      <description>&lt;P&gt;Yes, it's possible that you will have many errors to debug.&amp;nbsp; This first step was only to get the macro to run at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a way you can isolate the errors one at a time, so you can fix them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the bottom SELECT statements.&amp;nbsp; Get the first CONNECT/SELECT/DISCONNECT group to work.&amp;nbsp; You don't even need macro language to do this.&amp;nbsp; Just take the code out of the macro, and hard-code the NBIZ and BUSINESS_UNIT value(s).&amp;nbsp; Once that section of code is working, add in the next CONNECT/SELECT/DISCONNECT group.&amp;nbsp; By removing the macro language in order to debug, the error messages will become much clearer.&amp;nbsp; SAS will do a better job locating the source of the error.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 17:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correct-ERROR-All-positional-parameters-must-precede/m-p/294894#M270230</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-29T17:24:05Z</dc:date>
    </item>
  </channel>
</rss>

