BookmarkSubscribeRSS Feed
wbrian
Calcite | Level 5

Dear all,

I want to solve Ax=b for A. i.e. x and b are known vectors A is unknown matrix. Please can anybody let me know how to find the matrix A by proc iml..

Thank you in advanced.

2 REPLIES 2
SteveDenham
Jade | Level 19

Try posting this in the IML Forum, as can give you a direct reference to the documentation or his blog where this has been discussed.

Steve Denham

Rick_SAS
SAS Super FREQ

Did you mis-state the problem? Usually A and b are known and you need to find x.

As you've stated it, the problem has infinitely many solutions when x is not identically zero.

Since x is not all zeros, there is some element x_i which is nonzero. Construct the matrix A that is zero everywhere except for the i_th column, where it has the value b/x_i.

For example:

proc iml;
x = T(4:0);
b = T(1:3);


i=1;  /* for this problem x[1] is nonzero */

A = j(nrow(b), nrow(x), 0);
A[,i] = b/x;

diff = A*x-b; /* compute A*x - b */
print diff;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 438 views
  • 0 likes
  • 3 in conversation