<?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: ERROR: Open code statement recursion detected. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340669#M77892</link>
    <description>&lt;P&gt;There is a typo in your PROC TRANSPOSE statement - DROP not SROP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When passing values that are to be quoted, it is much safer to do the quoting in the code instead of in the parameter.&amp;nbsp; For instance the WHERE becomes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where paramcd="&amp;amp;paramcd";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This allows the macro call to become:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%stat(paramcd=TFDG2RD,aval=months,m=1,n=1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because of the way that quoted strings are parsed, this can make a difference.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2017 06:14:12 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2017-03-14T06:14:12Z</dc:date>
    <item>
      <title>ERROR: Open code statement recursion detected.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340629#M77874</link>
      <description>&lt;P&gt;When I ran this macro, I got two errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open code statement recursion detected.&lt;/P&gt;
&lt;P&gt;ERROR: Macro keyword MEND appears as text. A semicolon or other delimiter may be missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what causes these two errors? Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro stat(paramcd=,aval=,m=,n=);
proc univariate data=adptdc noprint;
  by arm;
  var &amp;amp;aval;
  where paramcd=&amp;amp;paramcd; /*paramcd='TFMT2RD';*/
  output out=TFMT2RD n=n mean=mean std=sd median=median min=min max=max q1=q1 q3=q3;
run;

proc format;
  value stat  
   1='n'
   2='Mean (SD)'
   3='Median'
   4='Q1 - Q3'
   5='(Min-Max)';
run;

data TFMT2RD_;
set TFMT2RD;
length stat_ $ 10  col $ 20;
  stat=1; stat_ = trim(left(put(stat, stat.))); col = put(n,3.);                                  output;
  stat=2; stat_ = trim(left(put(stat, stat.))); col = put(mean,5.1)||' ('||put(sd,5.2)||')';      output;
  stat=3; stat_ = trim(left(put(stat, stat.))); col = put(q1,5.1)||' - '||strip(put(q3,5.1));     output;
  stat=4; stat_ = trim(left(put(stat, stat.))); col = put(median,5.1);                            output;
  stat=5; stat_ = trim(left(put(stat, stat.))); col = '('||put(min,5.1)||' - '||strip(put(max,5.1))||')';   output;
  keep  arm stat stat_ col;
run;

proc sort data=TFMT2RD_; by stat stat_;run;
proc transpose data=TFMT2RD_ out=mean_TFMT2RD (srop=_name_);
by stat stat_;
var col;
id arm;
run;

***Unstratified P-value;
proc npar1way wilcoxon data=adptdc_1;
class arm;
var &amp;amp;aval;
where paramcd=&amp;amp;paramcd; /*paramcd='TFMT2RD';*/
output out = pvalue wilcoxon;
run;

data pvalue_;
set pvalue;
stat=6;
stat_="Unstr P";
LU_177_OCTREOTATE=put(P2_WIL,6.4);
keep stat stat_ LU_177_OCTREOTATE;
run;

* stratefy OCTDOSTR &amp;amp; OCTUPTSR;
data stratefy;
merge adptdc_1 (in=a) adam.adsl(keep=usubjid arm OCTDOSTR OCTUPTSR);
by usubjid;
if a;
if paramcd=&amp;amp;paramcd; /*paramcd='TFMT2RD';*/
run;

Proc freq data=stratefy noprint;
  table OCTDOSTR * OCTUPTSR *arm * &amp;amp;aval / score=modridit cmh;
  output out = pvalue_cmh cmh;
Run;

data pvalue_cmh_;
set pvalue_cmh;
stat=7;
stat_="Stra P";
LU_177_OCTREOTATE=put(P_CMHCOR,6.4);
keep stat stat_ LU_177_OCTREOTATE;
run;

data stat_&amp;amp;m_&amp;amp;n;
set mean_TFMT2RD pvalue_ pvalue_cmh_;
run;
%mend stat;&lt;BR /&gt;&lt;BR /&gt;%stat(paramcd='TFDG2RD',aval=months,m=1,n=1);&lt;BR /&gt;%stat(paramcd='TFDG2RD',aval=years,m=1,n=2);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 02:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340629#M77874</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-03-14T02:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Open code statement recursion detected.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340632#M77875</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56807"&gt;@fengyuwuzu&lt;/a&gt;&amp;nbsp;Run it with macro debugging options on and post the log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 03:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340632#M77875</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-14T03:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Open code statement recursion detected.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340669#M77892</link>
      <description>&lt;P&gt;There is a typo in your PROC TRANSPOSE statement - DROP not SROP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When passing values that are to be quoted, it is much safer to do the quoting in the code instead of in the parameter.&amp;nbsp; For instance the WHERE becomes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where paramcd="&amp;amp;paramcd";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This allows the macro call to become:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%stat(paramcd=TFDG2RD,aval=months,m=1,n=1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because of the way that quoted strings are parsed, this can make a difference.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 06:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340669#M77892</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2017-03-14T06:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Open code statement recursion detected.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340676#M77896</link>
      <description>&lt;P&gt;At the very end, you are missing a &lt;FONT color="#FF0000"&gt;dot&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data stat_&amp;amp;m&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;_&amp;amp;n;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without it, SAS doesn't know if the name of the macro variable should be &amp;amp;M or &amp;amp;M_&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 07:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340676#M77896</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-14T07:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Open code statement recursion detected.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340710#M77927</link>
      <description>&lt;P&gt;A good example of why always putting dots at the end of macro variables should be good programming practice (and it highlights macro variables in your code in the enhanced editor also).&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 09:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Open-code-statement-recursion-detected/m-p/340710#M77927</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-14T09:33:52Z</dc:date>
    </item>
  </channel>
</rss>

