Date: Sat, 26 May 2007 15:06:39 -0400
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Dorfman <sashole@BELLSOUTH.NET>
Subject: Re: Proc FCMP and recursion
Content-Type: text/plain; charset=ISO-8859-1
Whoa, wait a minute!
First, PROC FCMP is available in 9.1.3 (at least with SP4) - only the subroutines and functions compiled by it cannot be used in the DATA step (for THAT, one has to wait until 9.2, and I, for one, am looking forward to it, and fancy the possibilities it promises). To ascertain this simple fact, just run the example cited by the poster, or even a slightly modified one like this:
proc fcmp outlib = sasuser.funcs.math ;
function fact(k) ;
if k = 1 then return(k) ;
put K = ;
z = k ; *preserve k ;
x = fact(k-1) ;
put 'after ' k = ;
k = z ; *recover k ;
k = k * x ;
options cmplib=sasuser.funcs ;
proc fcmp ;
x = fact (5) ;
put x = ;
And you will see that it runs perfectly well and prints what the PUTs tell it to print in the output (I had expected to find it in the log). Moreover, go to SASUSER, and you will find the catalog FUNCS with entires neatly stored as follows:
Name Type Description
f(*)Subr0 cmpsub fact
And you can click on each of them and - surprise? - find their definitions inside. Looks like good folks at Base R&D look forward somewhat ahead of the time.
Secondly, one does not have to break the law in order to run 9.2. I have for a year now and been receiving incremental upgrades. Just enter MDPA (Master Developer Parnter Agreement), do the (scant) paperwork, and nine-two away. Incidentally, the contact for MDPA, Yvette Robers, operates from Austin, just email her at email@example.com and express interest.
Finally, I have to thank the original (albeit anonymous) poster, since although I cannot answer his/her question yet, it spurred my interest. And I have a question myself about the source of PROC COMP documentation you are relying upon. The pointer will be appreciated!
>From: toby dunn <tobydunn@HOTMAIL.COM>
>Date: 2007/05/26 Sat AM 12:39:24 EDT
>Subject: Re: Proc FCMP and recursion
>SUBSCRIBE SAS-L Anonymours ,
>First off if you have access tyo proc fmcp you have a beta version of 9.2,
>which means you have signed your life away or you are tempting fate of the
>SAS Lawyers. If I were you I would one first stop posting 9.2 questions
>like to the list serve for legal reasons and two talk to your sas admin who
>will route your question to the right SI person.
>On the other hand, you have different fingers. ~ LCG
>The early bird may get the worm, but the second mouse gets the cheese in the
>trap. ~ LCG
>What happens if you get scared half to death, twice? ~ LCG
>From: SUBSCRIBE SAS-L Anonymours <weiming.zhang@UCHSC.EDU>
>Reply-To: SUBSCRIBE SAS-L Anonymours <weiming.zhang@UCHSC.EDU>
>Subject: Proc FCMP and recursion
>Date: Fri, 25 May 2007 16:05:23 -0400
>I have been using Proc FCMP to do recursion. I found that it may modify the
>variable in the caller. For instance,
>proc fcmp outlib=sasuser.funcs.math;
>if k = 1 then return(k);
>put "pre K = " k;
>z = k; *preserve k;
>x = fact(k-1);
>put "after k = " k;
>k = z; *recover k;
>k = k * x;
>x = fact(5);
>put "x = " x;
>it will not give correct answer if the two commented line are removed. Does
>anyone know why?
>Catch suspicious messages before you open themówith Windows Live Hotmail.