BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SlutskyFan
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

6 REPLIES 6
Rick_SAS
SAS Super FREQ

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;

art297
Opal | Level 21

: Did you mean 9.3M2?  I'm running SAS/OR 9.3_M1 (thus don't have 12) and they don't work for me either.

Rick_SAS
SAS Super FREQ

Yes. Sorry for the typo. 12.1 is the most recent release of 9.3.

SlutskyFan
Obsidian | Level 7

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.

SlutskyFan
Obsidian | Level 7

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

Rick_SAS
SAS Super FREQ

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.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 6 replies
  • 2921 views
  • 1 like
  • 3 in conversation