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

Hello everyone,

 

I'm using SAS Base/ SAS Enterprise Guide and I'm stuck.
I need to create the Association Rules matrix to calculate the support, lift, confidence and other association metrics.

 

My table is similar to: (one line per client with all the products associated to)

data test;
input item1 item2 item3 item4 ;
datalines ;
1 0 1 0
1 1 1 0
1 0 1 0
1 0 1 1
;

As you know for the market basket analysis I want something like that:

          item1 item2 item3 item4

item1   4         1       4        1

item2   1         1       1        0

item3    4        1       4        1

item4    1         0      4        4

 

Thank you for your help.

1 ACCEPTED SOLUTION
3 REPLIES 3
Reeza
Super User

Here's a nifty little trick using PROC CORR:

 

data test;
input item1 item2 item3 item4 ;
datalines ;
1 0 1 0
1 1 1 0
1 0 1 0
1 0 1 1
;

ods output sscp=want;
proc corr data=test sscp;
var item1-item4;
run;

proc print data=want;
run;

PS. Thank you for providing sample data as a data step!

 


@alorenzo wrote:

Hello everyone,

 

I'm using SAS Base/ SAS Enterprise Guide and I'm stuck.
I need to create the Association Rules matrix to calculate the support, lift, confidence and other association metrics.

 

My table is similar to: (one line per client with all the products associated to)

data test;
input item1 item2 item3 item4 ;
datalines ;
1 0 1 0
1 1 1 0
1 0 1 0
1 0 1 1
;

As you know for the market basket analysis I want something like that:

          item1 item2 item3 item4

item1   4         1       4        1

item2   1         1       1        0

item3    4        1       4        1

item4    1         0      4        4

 

Thank you for your help.


 

alorenzo
Calcite | Level 5
THanks a lot it's perfect

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!

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
  • 3 replies
  • 1340 views
  • 5 likes
  • 2 in conversation