<?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 a macro error: ERROR:: All positional parameters must precede keyword parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361378#M85208</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rep(in=,param=,critn=,crit=);
proc report data=&amp;amp;in. nowd missing headskip headline split='^' ls=&amp;amp;ls;
     column ('--' avisitn avisit ("Treatment A^--^(N=%eval(&amp;amp;N1))^--^Number of Subjects (%)^--" (n1 n2 n3 n4 n5 n6 n7 n8)));
/*	 define param / order noprint;*/
/*	 define critn / order noprint;*/
/*	 define crit / order noprint;*/
	 define avisitn / order noprint;
	 define avisit  / "Visit " width=20 spacing=0 left flow display id;
	  define n1/"n" width=4 center spacing=1;
	  %if &amp;amp;critn.=1 %then %do;
	  define n2/"High *a" width=14 center spacing=1;
	  %end;
	  %if &amp;amp;critn.=2 %then %do;
	  define n2/"Low *a" width=14 center spacing=1;
	  %end;
	  define n3/"Grade 0" width=14 center spacing=1;
	  define n4/"Grade 1" width=14 center spacing=1;
	  define n5/"Grade 2" width=15 center spacing=1;
	  define n6/"Grade 3" width=15 center spacing=1;
	  define n7/"Grade 4" width=15 center spacing=1;
	  define n8/"Missing *c" width=15 center spacing=1;

/*	 break after crit/ page;*/
	 compute before _page_;
	  line @1 "&amp;amp;param.";
	  line @1 'CTCAE Criterion: ' "&amp;amp;crit.";
	 endcomp;

     compute after _page_ ;
	   line &amp;amp;ls*'-';
	   line @1 'Abbreviations: N = number of subjects in population;';
	   line @1 '               n = number of subjects with data collected (includes missing values) for a specific lab parameter at each timepoint.';
	   line @1 "The denominator for 'Worst' is the total number of patients who had at least one post-baseline value data point,";
	   line @1 "with value either missing or non missing.";
	   line @1 '*a -- &amp;lt;High/Low&amp;gt; category counts the number of subjects for whom the values of the given lab test are abnormally &amp;lt;High/Low&amp;gt;';
	   line @1 '      and the CTCAE criterion in the table header is defining values that are abnormally &amp;lt;Low/High&amp;gt;;';
	   line @1 "*c -- the 'missing' category displays the number of subjects who provided only missing data for the given visit.";
	   line @1 '';
/*	   line @1 "Data cut-off date: &amp;amp;cutoffdc;";*/
	   line @1 "Program Location:  &amp;amp;curpath\&amp;amp;pgmname..sas";
	   line @1 "Output Location :  %upcase(&amp;amp;outdir)\&amp;amp;outfile..rtf";
	   line @1 "Data Location   :  %upcase(&amp;amp;sdtm.)";
	   line @1 "                :  %upcase(&amp;amp;adam.)"; 
     endcomp;
run;
%mend;
%macro proc;
%do i=1 %to 67;
  %do j=1 %to 2;
   data temp1;
      set final;
	  where ord=&amp;amp;i and critn=&amp;amp;j;
	  call symput('param',param);
	  call symput('crit',crit);
   run;
   proc sql noprint;
  select count(*) into: nobs from temp1;
quit;
 
%if &amp;amp;nobs &amp;gt; 0 %then %do;
   %rep(in=temp1,param=&amp;amp;param,critn=&amp;amp;j,crit=&amp;amp;crit);
  %end;
%end;
%end;

%mend;

%proc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got the error:&lt;/P&gt;
&lt;P&gt;NOTE: There were 26 observations read from the data set WORK.FINAL.&lt;BR /&gt; WHERE (ord=5) and (critn=1);&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 26 observations and 25 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR:: All positional parameters must precede keyword parameters&lt;BR /&gt;NOTE: Line generated by the invoked macro "PROC".&lt;BR /&gt;500 %rep(in=temp1,param=&amp;amp;param,critn=&amp;amp;j,crit=&amp;amp;crit);&lt;BR /&gt; _____&lt;BR /&gt; 180&lt;/P&gt;
&lt;P&gt;ERROR: 180-322: Statement is not valid or it is used out of proper order&lt;BR /&gt;The SAS System&lt;/P&gt;
&lt;P&gt;NOTE: There were 0 observations read from the data set WORK.FINAL.&lt;BR /&gt; WHERE (ord=5) and (critn=2);&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 0 observations and 25 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the beginning the error appeared when (ord=17 and critn=1) ans also for (ord=38 and critin=2), but somehow now this appears for ord=5 and critn=1. I did not change anything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyone knows about this error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2017 20:17:22 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2017-05-24T20:17:22Z</dc:date>
    <item>
      <title>a macro error: ERROR:: All positional parameters must precede keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361378#M85208</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rep(in=,param=,critn=,crit=);
proc report data=&amp;amp;in. nowd missing headskip headline split='^' ls=&amp;amp;ls;
     column ('--' avisitn avisit ("Treatment A^--^(N=%eval(&amp;amp;N1))^--^Number of Subjects (%)^--" (n1 n2 n3 n4 n5 n6 n7 n8)));
/*	 define param / order noprint;*/
/*	 define critn / order noprint;*/
/*	 define crit / order noprint;*/
	 define avisitn / order noprint;
	 define avisit  / "Visit " width=20 spacing=0 left flow display id;
	  define n1/"n" width=4 center spacing=1;
	  %if &amp;amp;critn.=1 %then %do;
	  define n2/"High *a" width=14 center spacing=1;
	  %end;
	  %if &amp;amp;critn.=2 %then %do;
	  define n2/"Low *a" width=14 center spacing=1;
	  %end;
	  define n3/"Grade 0" width=14 center spacing=1;
	  define n4/"Grade 1" width=14 center spacing=1;
	  define n5/"Grade 2" width=15 center spacing=1;
	  define n6/"Grade 3" width=15 center spacing=1;
	  define n7/"Grade 4" width=15 center spacing=1;
	  define n8/"Missing *c" width=15 center spacing=1;

/*	 break after crit/ page;*/
	 compute before _page_;
	  line @1 "&amp;amp;param.";
	  line @1 'CTCAE Criterion: ' "&amp;amp;crit.";
	 endcomp;

     compute after _page_ ;
	   line &amp;amp;ls*'-';
	   line @1 'Abbreviations: N = number of subjects in population;';
	   line @1 '               n = number of subjects with data collected (includes missing values) for a specific lab parameter at each timepoint.';
	   line @1 "The denominator for 'Worst' is the total number of patients who had at least one post-baseline value data point,";
	   line @1 "with value either missing or non missing.";
	   line @1 '*a -- &amp;lt;High/Low&amp;gt; category counts the number of subjects for whom the values of the given lab test are abnormally &amp;lt;High/Low&amp;gt;';
	   line @1 '      and the CTCAE criterion in the table header is defining values that are abnormally &amp;lt;Low/High&amp;gt;;';
	   line @1 "*c -- the 'missing' category displays the number of subjects who provided only missing data for the given visit.";
	   line @1 '';
/*	   line @1 "Data cut-off date: &amp;amp;cutoffdc;";*/
	   line @1 "Program Location:  &amp;amp;curpath\&amp;amp;pgmname..sas";
	   line @1 "Output Location :  %upcase(&amp;amp;outdir)\&amp;amp;outfile..rtf";
	   line @1 "Data Location   :  %upcase(&amp;amp;sdtm.)";
	   line @1 "                :  %upcase(&amp;amp;adam.)"; 
     endcomp;
run;
%mend;
%macro proc;
%do i=1 %to 67;
  %do j=1 %to 2;
   data temp1;
      set final;
	  where ord=&amp;amp;i and critn=&amp;amp;j;
	  call symput('param',param);
	  call symput('crit',crit);
   run;
   proc sql noprint;
  select count(*) into: nobs from temp1;
quit;
 
%if &amp;amp;nobs &amp;gt; 0 %then %do;
   %rep(in=temp1,param=&amp;amp;param,critn=&amp;amp;j,crit=&amp;amp;crit);
  %end;
%end;
%end;

%mend;

%proc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got the error:&lt;/P&gt;
&lt;P&gt;NOTE: There were 26 observations read from the data set WORK.FINAL.&lt;BR /&gt; WHERE (ord=5) and (critn=1);&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 26 observations and 25 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR:: All positional parameters must precede keyword parameters&lt;BR /&gt;NOTE: Line generated by the invoked macro "PROC".&lt;BR /&gt;500 %rep(in=temp1,param=&amp;amp;param,critn=&amp;amp;j,crit=&amp;amp;crit);&lt;BR /&gt; _____&lt;BR /&gt; 180&lt;/P&gt;
&lt;P&gt;ERROR: 180-322: Statement is not valid or it is used out of proper order&lt;BR /&gt;The SAS System&lt;/P&gt;
&lt;P&gt;NOTE: There were 0 observations read from the data set WORK.FINAL.&lt;BR /&gt; WHERE (ord=5) and (critn=2);&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 0 observations and 25 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the beginning the error appeared when (ord=17 and critn=1) ans also for (ord=38 and critin=2), but somehow now this appears for ord=5 and critn=1. I did not change anything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyone knows about this error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361378#M85208</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-24T20:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: a macro error: ERROR:: All positional parameters must precede keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361380#M85209</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9036i3E9C5C70E6BD80F3/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361380#M85209</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-24T20:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: a macro error: ERROR:: All positional parameters must precede keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361385#M85210</link>
      <description>&lt;P&gt;Since we can't see the data I have a suspicion that the value of &amp;amp;param as passed in this line:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt; %&lt;/FONT&gt;&lt;FONT color="#bf0060" face="SAS Monospace" size="2"&gt;rep&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;(in=temp1,param=&amp;amp;param,critn=&amp;amp;j,crit=&amp;amp;crit);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;may contain a comma.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Suppose &amp;amp;param = value1, value2&amp;nbsp;&amp;nbsp;&amp;nbsp;the macro compiler may see something that looks like&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt; %&lt;/FONT&gt;&lt;FONT color="#bf0060" face="SAS Monospace" size="2"&gt;rep&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;(in=temp1,param= value1, value2,critn=&amp;amp;j,crit=&amp;amp;crit); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Critn gets pointed as as the place for the error because it cannot point to "value2" in the error message.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Example that demonstrates the exact same problem:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;%macro dummy(in=,param=,critn=,crit=);
%put &amp;amp;in &amp;amp;param &amp;amp;critn &amp;amp;crit;
%mend;

%let param= value1, value2;
%dummy (in=1, param=&amp;amp;param,critn=3, crit=4);

&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;The fix will be to ensure that the &amp;amp;param passed to %rep does not have any comma OR macro quote it to ignore the comma.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Examine the values of the variable Parm in the set Final.&lt;/P&gt;
&lt;P&gt;Note that having PARAM in so many places is making it hard to distinguish between usages: Data step variable and at least 2 Macro variables.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361385#M85210</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-24T20:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: a macro error: ERROR:: All positional parameters must precede keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361388#M85212</link>
      <description>&lt;P&gt;yes. that params is&lt;/P&gt;
&lt;P&gt;BLOOD Neutrophils, Segmented (10^9/L)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there is a ,&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361388#M85212</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-24T20:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: a macro error: ERROR:: All positional parameters must precede keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361389#M85213</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56807"&gt;@fengyuwuzu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;yes. that params is&lt;/P&gt;
&lt;P&gt;BLOOD Neutrophils, Segmented (10^9/L)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there is a ,&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You could either use a function in the data step to remove/replace the comma in the varialbe or change the macro call to look like:&lt;/P&gt;
&lt;PRE&gt;%dummy (in=1, param=%quote(&amp;amp;param),critn=3, crit=4);
&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 20:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-macro-error-ERROR-All-positional-parameters-must-precede/m-p/361389#M85213</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-24T20:37:24Z</dc:date>
    </item>
  </channel>
</rss>

