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 (July 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 4 Jul 2008 13:43:33 -0500
Reply-To:   paul@WUBIOS.WUSTL.EDU
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Paul Thompson <paul@WUBIOS.WUSTL.EDU>
Subject:   Re: do-while and proc iml
Comments:   To: Daniel Nordlund <djnordlund@VERIZON.NET>
In-Reply-To:   <02a301c8de01$ef954590$0201a8c0@Aragorn>
Content-Type:   text/plain; charset=UTF-8; DelSp="Yes"; format="flowed"

Quoting Daniel Nordlund <djnordlund@VERIZON.NET>:

Although I don't usually say this, I must disagree with Dan. Macro code in IML is executed immediately. Each statement in IML is executed as it is encountered, and in this way, macro code in IML behaves differently than in other areas of SAS. You can do what is being requested, although some of the details of his attempts are incorrect.

>> -----Original Message----- >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >> domenico >> Sent: Friday, July 04, 2008 8:28 AM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Re: do-while and proc iml >> >> On 4 Lug, 14:26, p...@WUBIOS.WUSTL.EDU (Paul Thompson) wrote: >> >> Why are you using a macro function eval to perform a computation using >> > iml functions? eval performs integer arithmetic for macro variables. >> > Perhaps you wish to use sysfunc, or perhaps you wish to perform the >> > computation and then convert the results using call symput. I think >> > the latter. >> > >> >> I followed your suggestion and in the same macro I inserted: >> call symput (h, sum (x_ij & m)); >> >> instead of: >> >> % let h = %eval (sum (x_ij & m));. >> >> The macro run the same cycle indefinitely (the condition included in >> the "do-while" remains true, I believe) and then always get the >> following error message: >> >> >> >> NOTE: IML Ready >> ERROR: (execution) Module not loaded, operation not available. >> >> operation: SYMPUT at line 150 column 1 >> operands: H, _TEM1002 >> >> H 0 row with 0 (type?, Size 0) >> >> >> _TEM1002 1 with row 1 (numeric) >> >> 50 >> >> statement: CALL at line 150 column 1 >> NOTE: Exiting IML. > > The main problem you are going to have here is one of timing. Macro > code is executed before your proc iml code. So even if your code > could run as written, the matrices x_i and x_ij are not available > when the macro code is evaluated. This is a common mistake with new > users of macro language. > > Also, many have found it helpful to think of macro programming as > text substitution (although something of an over simplification). > Your macro code generates SAS code (data step statements, sql code, > proc code, etc.) which is "substituted" into your code. Mark > Terjeson has some simple descriptions of macro processing that > discusses this in the SAS-L archives. Here is a link to one of them. > > > > Hope this is helpful, > > Dan > > Daniel Nordlund > Bothell, WA USA >

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