Date: Mon, 13 Jul 1998 15:33:14 0400
ReplyTo: Rodney Sparapani <spara002@DUKE.EDU>
Sender: "SAS(r) Discussion" <SASL@UGA.CC.UGA.EDU>
From: Rodney Sparapani <spara002@DUKE.EDU>
Organization: Duke Clinical Research Institute
Subject: Re: Recursion in SAS macro language, reality or uthopia ?
ContentType: text/plain; charset=usascii
Fabrizio:
Can you reformulate the problem so that multiple SAS jobs operate on the
problem
instead of doing all of the recursion with the macro language? I've used
recursion in SAS macros for permutations and combinations, but never 46 levels.
Rodney
Fabrizio Carinci wrote:
> Hi SASLers,
> here is a program addressed in the past on SASL but apparently remained
> unsolved (as far as I know).
>
> Recursion is a programming technique not always suggested,
> but sometimes necessary for statistical and numerical
> analysis reasons.
>
> In my case, I'm writing some code to perform calculations for
> likelihood crossvalidation in the case of a COX PH discrete logistic
> model. More precisely, I need to implement the technique used by PROC
> PHREG for TIES=DISCRETE which has been originally published by Gail et
> al., 1983 (referenced in SAS/STAT manual up to v. 6.11).
>
> Unfortunately, my SAS program aborted with the infamous error
> message "Maximum source manager level number exceeded. The nesting of
> %INCLUDE files, or macros, or both, is too deep".
>
> As an example, one can keep the following macro and look
> what happens:
>
> =================
>
> %let p=0;
>
> %MACRO TECCHIO;
> %let p=%eval(&p+1);
> %put LOOP No.&P DONE;
> %TECCHIO;
> %MEND TECCHIO;
>
> %TECCHIO;
>
> =================
>
> At the 46th loop on our AXP Digital machine it ends with the error
> message. I also noticed that the magical number is 47 on a SUN machine.
> (????).
>
> Since one usually need unlimited looping (today datasets come from very
> large databases), the lack of a recursion application of SAS macro
> language seems to me a major fault.
>
> Moreover, in our case we must write down all the recursive formula and
> at the end perform the final calculation, which means that I can't work
> with DATASTEPS or IML.
>
> Any hints will be appreciated.
> Thanks in advance.
> Fabrizio
>
>
==============================================================================
> Fabrizio Carinci, Statistician
> Head, Unit of Statistics and Information Systems,
> Department of Clinical Pharmacology and Epidemiology
> Consorzio Mario Negri Sud, Strada Nazionale66030 S.Maria Imbaro
(Chieti)ITALY
> Web: http://www.cmns.mnegri.it
>

> TEL: 39872570265 FAX: 39872578240 EMAIL: carinci@cmns.mnegri.it
>
==============================================================================
