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.
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.
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.