I am just learning SAS. I am doing a simple problem for a statistics class using SAS 9.4 and have run into a problem that I do not understand the error message and how to resolve the error. The proble is to create an inverse of a matrix.
The following is the code I used:
proc iml;
A={1 2, 2 -2, 3 10};
B=A`;
print A B;
run;
AB=A*B;
print AB;
run;
invAB=inv(AB);
print invAB;
run;
The following is the error message that I am receiving:
1 proc iml;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: IML Ready
2 A={1 2, 2 -2, 3 10};
3 B=A`;
4 print A B;
5 run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
6
7 AB=A*B;
8 print AB;
9 run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
10
11 invAB=inv(AB);
ERROR: (execution) Matrix should be non-singular.
operation : INV at line 11 column 10
operands : AB
AB 3 rows 3 cols (numeric)
5 -2 23
-2 8 -14
23 -14 109
statement : ASSIGN at line 11 column 1
12 print invAB;
ERROR: Matrix invAB has not been set to a value.
statement : PRINT at line 12 column 1
13 run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
I am using code that was supplied by the instructor (which worked). I changed nothing with the instructor's code, but can not get a resolution. What am I doing wrong?
Thank you for your help
Thank you for your assistance.
If I'm not mistaken, the determinant of the matrix is equal to 0, so it can not be inverted
The error with INV is described here: http://support.sas.com/documentation/cdl/en/imlug/63541/HTML/default/viewer.htm#imlug_langref_sect15...
You need to define modules in IML before you can RUN them, this causes the notes.
I don't know if it is good to dive into IML when you are just starting out with learning SAS, but you should at least take a thorough look at the SAS/IML documentation (SAS/IML Overview).
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.
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.