Running PROCs on Your Facebook Friends (2011 version)


While talking to fellow SAS users at SAS Global Forum 2011 this week, I'll be discussing how SAS programmers can "play" with social media data that they can access on Facebook and Twitter. I always refer people to my blog for more information, and so I've prepared this blog post to make the information easy to find.

If you heard me talk about this topic at the conference and you're visiting the blog to learn more, Welcome! Here are the links to the additional materials that I've prepared.

Social Networking and SAS: Running PROCs on Your Facebook Friends (the paper):
Written with the help of Susan Slaughter, this paper describes how you can access different types of social media data, and provides some ideas for the analysis that you can perform with it.

Example Facebook application for gathering data (Windows application):
This application can be run standalone or as a custom task within SAS Enterprise Guide. You can use it to connect to your Facebook account, gather your friend data (names, education history, relationship status, birthdays, and more), and then save all of the information as a SAS program. You can then run the program in SAS (or via SAS Enterprise Guide).

An example of what the application looks like

The application generates some simple reports, but I'm confident that the creative SAS user community will be able to come up with even better results than I did.

Example SAS program to gather/analyze Twitter content (SAS program):
This program uses the XML LIBNAME engine, FILENAME URL, SGPLOT procedure, and a simple PROC PRINT to create a report of recent Twitter activity around a specified hashtag.

All of this information is also linked from this page on

I owe a big Thank You to Pete Lund, the section chair for the Social Media section at the conference, for inviting us to present on this topic. And also thanks to Susan Slaughter, who helped me to shape and validate the content for this paper and presentation.


About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies


  1. Warren Repole on

    After you obtain Facebook information, BE VERY CAREFUL with that information so that your friends' privacy is not breached.

    You can obtain friends' information through this app because you are logged into FB under your account and your friends allow you to see those items. But if you create a report containing those items, keep it to yourself so that it does not become visible beyond each friend's privacy "wall".

  2. Yes, Warren is correct. Note that the example application captures data only to your local PC and saves it within the SAS program. The data does not pass through any other 3rd party, nor is it stored in any location other than the file paths that you designate.

  3. Hi Chris,
    this application is very interesting
    One question: could it be applied to extract user data about groups or product pages? I would like to do some data mining on my group users (namely stast on age, gender, jobs ect).

  4. Chris Hemedinger on


    Perhaps it could be adjusted to gather membership information for groups or a list of fans for pages. However, it would not be able to gather any personal data that you cannot see otherwise (if you are not a "friend" of the user/fan).

  5. Pingback: Birthdays among friends - The SAS Dummy

  6. Pingback: Giving students The Power to Know - The SAS Dummy

  7. Pingback: Running SAS PROCs on your Facebook friends - SAS Users Groups

  8. Pingback: Running SAS PROCs on your Facebook friends - Customer Analytics

  9. Pingback: Custom tasks for SAS Enterprise Guide: Q&A - The SAS Dummy

  10. Pingback: 11 super-useful custom tasks for SAS Enterprise Guide - The SAS Dummy

  11. Pingback: Confessions of a SAS Dummy - The SAS Dummy

  12. Pingback: Using ODS EXCEL and PROC EXPORT to bundle Excel-based reports - The SAS Dummy

Back to Top