We’re smarter together. Learn from this collection of community knowledge and add your expertise.

Tip: Making Recommendations Using SAS® Enterprise Miner™ Link Analysis Node

by SAS Employee yeliu on ‎04-28-2014 10:08 AM - edited on ‎10-06-2015 02:10 PM by Community Manager (1,782 Views)

The Link Analysis node in SAS Enterprise Miner can make recommendations to customers based on their transactional history data by providing a next-best-offer list.


In this tip, I’ll cite an example to demonstrate how to use the Link Analysis node to get next-best-offer list for transactional data. If you are interested in how the Link Analysis node generates the next-best-offer list, refer to the paper, Link Analysis Using SAS® Enterprise Miner™, for details.




The example data set in this example is modified from data SAMPSIO. ASSOCS (stored in the sample library) contains 7,007 separate customer transactions. CUSTOMER is an ID variable that identifies the customers. PRODUCT is the nominal target variable.


We use the first 801 customers’ transaction data as the training data, and use the rest of the data as the data to be scored.


data assoc_train;

set sampsio.assocs(where=(customer le 800));



data assoc_score;

set sampsio.assocs(where=(customer gt 800));



Create a flow like the one in Display 1:



                                Display 1. Link Analysis Flow


First, use the following steps to configure the flow:

  1. Set the role of data assoc_train to Transaction, and set the role of data aasoc_score to Score.
  2. Set the variable roles for both data as follows:

        Right-click on each Ids (input data set) node and select Edit Variables. Assign the roles as shown in Display 2.




                                Display 2. Variable Roles

   3. Adjust the Score property of Link Analysis to get next-best-offer list. If you set Generate Recommendation Table to Yes (the default setting) in the Score property window, the next-best-offer list is displayed in the score output. You can export the full recommendation table, or the filtered recommendation table that results from specifying properties such as “Top N,” “Minimum Confidence (%),” and “Criterion Relation,” as shown in Display 3.



                     Display 3. Recommendation Table Properties Window


   4. Leave all other properties in the nodes of the flow as default, run the flow.




                       Display 4. Filtered Recommendation Table for Training Data


If you specify the settings shown in Display 3, a filtered recommendation table is displayed in Link Analysis node’s Results window, as shown in Display 4. The table contains the top three next-best offers for each of the customer ID from 0 to 800.


Now click on the Score node, and go to the property panel of it, as shown in Display 5.


Click to open the exported score data in the Score node, you will find the top-3 next-best-offers for customer ID from 801 to 1000, as shown in Display 6. For example, cracker, olives and corned beef are recommended for customer 801.



     Display 5. Score Code Property Panel



Display 6. Filtered Recommendation Table for Score Data



Your turn
Sign In!

Want to write an article? Sign in with your profile.

Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.