BookmarkSubscribeRSS Feed
bri11
Calcite | Level 5

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?

1 REPLY 1
Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 725 views
  • 3 likes
  • 2 in conversation