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

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.

 

Register now!

Multiple Linear Regression in SAS

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.

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