1

Suppose I have

  proc iml;
  x = {1,2,3};

I am interested in computing CDF ('F',1,2, ....) for every element of x. Of course, I can write a loop, but I would like to know the smart way of doing it, i.e. vectorise?

I tried to google but could not find anything, any takers?

Lost1
  • 990
  • 1
  • 14
  • 34

1 Answers1

0

When SAS/IML calls Base SAS functions, you can usually pass in a vector in place of the scalar arguments. In your example, it's as easy as c = cdf("Normal", x);

For more information, you can read about how to call Base SAS functions from SAS/IML. If the need arises, you can also pass in vectors for MULTIPLE arguments, provided that the vectors are the same size.

Rick
  • 1,210
  • 6
  • 11
  • couldn't believe the person who helped me is you! thanks a lot Rick! – Lost1 Oct 24 '14 at 08:35
  • Rick, how do I use SAS/IML in the university edition? (or can't I?) http://stackoverflow.com/questions/27178729/why-do-i-get-the-following-error-when-i-try-to-implementan-example-from-wicklin i cannot get the following code from your book to work. – Lost1 Nov 27 '14 at 21:28
  • 1
    Put PROC IML; at the top of the program. The University Edition supports PROC IML, but not SAS/IML Studio. Your code is not working because there is no version of R installed on the virtual machine (the vApp). – Rick Dec 08 '14 at 20:15