I'm not sure why I get the following error when I run the code that follows:
ERROR: Invocation of unresolved module NORM.
proc iml;
x = {1 2, 3 4};
print x;
mn1 = norm(x, "L1");
mnF = norm(x, "Frobenius");
mnInf = norm(x, "LInf");
print mnF;
print mn1;
run; quit;
That function was introduced in SAS/IML 12.1 (SAS 9.2M2). You must be running an earlier version.
However, those functions are simple to program. Here they are:
proc iml;
start matnorm(x, method);
s = substr(upcase(method), 1, 4);
isValid = (s="FROB" | s="L1" | s="LINF");
if ^isValid then return(.);
if (s="FROB") then do;
return( sqrt(x[##]) );
end;
else if (s="L1") then do;
return( max(x[+,]) );
end;
else if (s="LINF") then do;
return( max(x[,+]) );
end;
finish;
x={1 2, 3 4};
mn1 = matnorm(x, "L1");
mnF = matnorm(x, "Frobenius");
mnInf = matnorm(x, "LInf");
print mn1 mnF mnInf;
That function was introduced in SAS/IML 12.1 (SAS 9.2M2). You must be running an earlier version.
However, those functions are simple to program. Here they are:
proc iml;
start matnorm(x, method);
s = substr(upcase(method), 1, 4);
isValid = (s="FROB" | s="L1" | s="LINF");
if ^isValid then return(.);
if (s="FROB") then do;
return( sqrt(x[##]) );
end;
else if (s="L1") then do;
return( max(x[+,]) );
end;
else if (s="LINF") then do;
return( max(x[,+]) );
end;
finish;
x={1 2, 3 4};
mn1 = matnorm(x, "L1");
mnF = matnorm(x, "Frobenius");
mnInf = matnorm(x, "LInf");
print mn1 mnF mnInf;
Yes. Sorry for the typo. 12.1 is the most recent release of 9.3.
THat's what I'll do. As a side note, I have SAS 9.3 TS1MO. I'm not sure what version of SAS IML I actually have.
Thanks again Rick. I've run into this issue because I'm actually playing around with some SNA stuff. I'm also looking at incorporating some of your code from your post: The power method: compute only the largest eigenvalue of a matrix - The DO Loop
Right. Notice in that post I used the statement
normZ = sqrt( z[##] );
I try to avoid using new features in my blog posts for about least 6 months after a release.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.