LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 26 May 2007 15:06:39 -0400
Reply-To:     sashole@BELLSOUTH.NET
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <sashole@BELLSOUTH.NET>
Subject:      Re: Proc FCMP and recursion
Comments: To: toby dunn <tobydunn@HOTMAIL.COM>
Content-Type: text/plain; charset=ISO-8859-1

Tony,

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 ; return(k) ; endsub ; quit ;

options cmplib=sasuser.funcs ; proc fcmp ; x = fact (5) ; put x = ; run ;

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 f(*)Math fundcl

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 yvette.roberts@sas.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!

Kind regards ------------------- Paul Dorfman Jax, FL -------------------

> >From: toby dunn <tobydunn@HOTMAIL.COM> >Date: 2007/05/26 Sat AM 12:39:24 EDT >To: SAS-L@LISTSERV.UGA.EDU >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. > >Toby Dunn > >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> >To: SAS-L@LISTSERV.UGA.EDU >Subject: Proc FCMP and recursion >Date: Fri, 25 May 2007 16:05:23 -0400 > >Hi, > >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; >function fact(k); >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; >return(k); >endsub; >run;quit; > >options cmplib=sasuser.funcs; >proc fcmp; >x = fact(5); >put "x = " x; >run; > >it will not give correct answer if the two commented line are removed. Does >anyone know why? > >thanks. > >wz > >_________________________________________________________________ >Catch suspicious messages before you open themówith Windows Live Hotmail. >http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_protection_0507 >


Back to: Top of message | Previous page | Main SAS-L page