Statistical programming, matrix languages, and more

iml

Reply
New Contributor
Posts: 3

iml

how would you create a subroutine that accepts an nxn matrix, finds its inverse if the determinant is 0 or prints an error if the matrix's determinant isn't 0?

SAS Super FREQ
Posts: 3,408

Re: iml

Since you have asked several elementary questions, here is a link to an article that might help: How to learn SAS/IML: Five resources for the beginner - The DO Loop

In particular, tip #4 is relevant. When you write your funtion, you will need to use the

RETURN statement

IF-THEN/ELSE statement

DET function, and

INV function

BTW, your logic is backwards: if the determinant is NOT zero, you can compute the inverse.

Ask a Question
Discussion stats
  • 1 reply
  • 222 views
  • 3 likes
  • 2 in conversation