BookmarkSubscribeRSS Feed
daradanye
Obsidian | Level 7

Hi,

 

I have a table (matrix) like this:

 

idyearvar1var2var3….var300
11997345 6
11998521 3
……………………………………
12007536 2
21997112 0
……………………………………
22007316 0
31997245 4
 ………………………………
32006043 4
 ………………………………
50001997002 6
……………………………………
50002006312 6

That said, I have a lot of observations and variables.

 

Ideally, I want to calculate pairwise cosine similarity between two observations and output like this:

d1id2yeardistance
121997xx
131997xx
 
150002006xx
211997xx
 
250002006xx
 

 

 

I am exploring proc distance and proc iml but have not figured it out yet.  I will appreciate it very much if someone can help me out here.

 

Thanks!

2 REPLIES 2

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1354 views
  • 2 likes
  • 3 in conversation