BookmarkSubscribeRSS Feed
scrofungulus4
Calcite | Level 5

I have a set of, say 36 observations and wish to calculate the distance matrix for these observations.  Now I can do so with the use of a double do-loop, but this seems tedious (even though, for my purposes at this stage, computation time is negligible still).  I read that the "distance" operator can be used in this way:

delta = distance(matrix, "L2"); 

for, say, the Euclidian distance.  It seems like a nifty function, unfortunately on my SAS9.3 system, the log gives me an error saying "Invocation of unresolved module DISTANCE."

Anybody have an idea why this is? 

2 REPLIES 2
Rick_SAS
SAS Super FREQ

The DISTANCE function was introduced in SAS/IML 12.1, which was released as part of SAS 9.3M2 (the second maintenance releaase): See Support.sas.com

Rick_SAS
SAS Super FREQ

Of course, you can still write your own distance function by using the SAS/IML language, as shown in the following article:
How to compute the distance between observations in SAS - The DO Loop

sas-innovate-2024.png

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.

 

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
  • 2 replies
  • 796 views
  • 0 likes
  • 2 in conversation