Date: Mon, 13 Jul 1998 15:33:14 -0400
Reply-To: Rodney Sparapani <spara002@DUKE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@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 ?
Content-Type: text/plain; charset=us-ascii
Can you re-formulate the problem so that multiple SAS jobs operate on the
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.
Fabrizio Carinci wrote:
> Hi SAS-Lers,
> here is a program addressed in the past on SAS-L 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 cross-validation 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;
> %MEND 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 Carinci, Statistician
> Head, Unit of Statistics and Information Systems,
> Department of Clinical Pharmacology and Epidemiology
> Consorzio Mario Negri Sud, Strada Nazionale-66030 S.Maria Imbaro
> Web: http://www.cmns.mnegri.it
> TEL: 39-872-570265 FAX: 39-872-578240 E-MAIL: email@example.com