LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 8 Apr 2003 09:01:10 -0700
Reply-To:   Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:   Re: An IML and data set names question
Comments:   To: "GOMEZ TEJERINA, PEDRO ALBERTO" <PEDRO.GOMEZ@GRUPOBBVA.COM>
In-Reply-To:   <oDF609vnJG.PEDRO.GOMEZ@GRUPOBBVA.COM>
Content-Type:   text/plain; charset=us-ascii

Whoops, my fingers slipped and the message got sent before I was finished composing it. Here is the complete post.

Pedro,

You use a macro (vectores) to construct datasets c1, c2, ... In that macro, you properly employ a macro %do loop indexing on macro variable I to create references to the named datasets.

Now, in your IML code, you try to use an IML loop to construct an index variable I and then reference that IML variable as a macro variable. You are mixing up macro language and procedure language. Instead of using an IML do loop, use macro coding to create references to the datasets which you need. Put the IML code inside of the macro vectores (or construct a new macro) and use macro loops to construct macro variable I (which you are already referencing unsuccessfully). Thus, you might code

%macro lincombs; %global activos numcli; %local i; proc iml; use cor var {&activos}; read all var {&activos} into cor; close cor; %do i=1 %to &numcli %by 1; use c&i var {varpesos}; read all var {varpesos} into c&i; close c&i; VARc=J(1,1,0); VARc[1,]=t(c&i)*cor*c&i; free c&i; print VARc; call delete (c&i); %end; quit; %mend lincomb;

%lincomb

Best wishes,

Dale

--- "GOMEZ TEJERINA, PEDRO ALBERTO" <PEDRO.GOMEZ@GRUPOBBVA.COM> wrote: > --- Recibido de BBVACENT.U094016 GOMEZ TEJERINA, PEDRO AL* 08-04-03 > 10.05 > > -> SAS-L@LISTSERV.UGA.EDU > > Dear SAS users, > > I have several datasets called "c1","c2","c3",..... for which I would > like > to perform a matrix multiplication. This names seem not to be > recognised by > IML when I try to create a matrix from each data set. Could anybody > give > some hint? > > Many thanks for your help. > > This is the code I am currently using: > > proc sql noprint; > select count (cliente) into: numcli > from saldos2; > quit; > run; > > %macro vectores; > %do i=1 %to 1; > data c&i; > set pru (where=(cliente=&&cli&i)); > run; > %end; > %mend; > > %vectores; > > proc iml; > use cor var {&activos}; > read all var {&activos} into cor; > close cor; > do i=1 to &numcli by 1; > use c&i var {varpesos}; > read all var {varpesos} into c&i; > close c&i; > VARc=J(1,1,0); > VARc[1,]=t(c&i)*cor*c&i; > free c&i; > print VARc; > end; > call delete (c&i); > > > > > And this is the log: > > > 642 proc iml; > NOTE: IML Ready > 643 use cor var {&activos}; > 644 read all var {&activos} into cor; > NOTE: I/O required temporary file to be opened. > 645 *\print datos; > 646 close cor; > 647 do i=1 to &numcli by 1; > WARNING: Apparent symbolic reference I not resolved. > 648 use c&i var {varpesos}; > - > 22 > 76

----- snip -----

===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@fhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com


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