| Date: | Thu, 16 Sep 1999 19:30:15 -0500 |
| Reply-To: | shiling@math.wayne.edu |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Shiling Zhang <shiling@MATH.WAYNE.EDU> |
| Organization: | Wayne State University |
| Subject: | Re: SAS/IML: "Select If" Function??? |
|
| Content-Type: | text/plain; charset=us-ascii |
Max,
The loc function does that. The loc function gives you the index which
satisfy the condition. I guess your selif is equivelent to
c=a(loc(a>0)).
Hope it helps.
proc iml;
do i = 1 to 9;
x=rannor(123);
a=a//x;
end;
b=loc(a>0)`;
c=a(|b|);
print a b c;
quit;
run;
A B C
-0.326593 2 1.5424369
1.5424369 3 0.2590291
0.2590291 5 0.7787204
-0.555834 9 0.7242336
0.7787204
-0.655197
-0.022105
-0.772647
0.7242336
max_reid@MY-DEJA.COM wrote:
> Does SAS/IML have an equivalent of Gauss's SELIF function?
>
> The SELIF function in Gauss defines a submatrix from an input matrix
> according to some Boolean expression. Such an extraction could be
> accomplished via a loop, but I am looking for a "vectorized" function.
>
> Thanks,
>
> Max
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
|