Date: Tue, 27 Mar 2012 10:10:32 +0100
Reply-To: Ian <ian.wakeling@HANANI.QISTATS.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian <ian.wakeling@HANANI.QISTATS.CO.UK>
Subject: Re: sum of n matrices in proc IML
In-Reply-To: <201203262014.q2QFuoeI014559@willow.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I don't think there is a way to do this without using 'call execute',
which will tend to make things rather ugly. For example:
proc iml;
start main;
em1=10; em2=11; em3=12; em4=13;
call execute(concat("s=sum(0" , rowcatc(",em1":",em4"),");"));
print s;
finish;
run main;
quit;
Perhaps you would be much better off not to use a series of scalars, but
to keep the values in a vector.
Hope that helps,
Ian.
On 26/03/2012 21:14, Mark Miller wrote:
> Randall,
>
> Obvious way is to use SUM(em1,em2,....,emN)
> My IML is rusty so I'm unsure if there is a way to handle the suffix
> in an automatic fashion, like a wild-card.
>
> ... Mark Miller
>
> On Mon, Mar 26, 2012 at 12:25 PM, Randall Powers<powers_r@bls.gov> wrote:
>
>> Hello SAS folks,
>>
>> I have 1x1 matrices em1, em2, em3....em&n.
>>
>> I want to find a sum of all of the values of em1-em&n in proc IML.
>>
>> How would I do this?
>>
>> Thanks so much,
>>
>> RP
>>
|