BookmarkSubscribeRSS Feed

How to create calendar events from SAS Visual Analytics

Started ‎02-03-2017 by
Modified ‎02-03-2017 by
Views 5,051

As I mentioned in my previous post, I'm a huge football fan.  Part of being such a big football fan is having schedules memorized for both the US-based Carolina Panthers and the North Carolina State University Wolfpack teams.  However I've had to recently accept the fact that not everyone is as into football as I am (what??).  And that more often than not, people don't rely on memory to know when important dates are, but instead depend on the calendars that are on their mobile devices.  


So the question became for me, how can I help my friends remember when the big football games are?  The answer is: provide an easy way for them to place the games on their calendars.  Examples of how to do this are spread across the web. Perhaps last time you were looking at upcoming concerts at your favorite music venue, there is often an 'add to calendar' button on the website.  This is how you can really get events to STICK with consumers, by allowing them to add events to their personal calendars with a simple click of a mouse.


In my previous post, I created a custom schedule chart with an accompanying table of all the important football games.  Wouldn't it be great if there was a way to select a game from the table and add it to your calendar?  Well as it turns out, there is!  SAS Visual Analytics 7.3's Stored Process integration not only enables us to create calendar events, but it makes it easy to do so.  Below is an example of how I added the upcoming NC State vs. Miami game to my calendar.


Picking up from where we left off in the previous post, I have selected all of the 'big football weekends' from the schedule chart on the left.  The built in interaction which was enabled from our custom schedule chart, filters the table on the right.  I'm interested in adding the Miami game on November 19th to my calendar:




By clicking the row in the table, a popup window offers me the option to "External Link to Download ICS File"




After clicking this, an 'ics' file is dynamically created and offered to me as a download:




When I click "Open," the event I clicked on is automatically added to my Outlook calendar.




So how did I get Visual Analytics to do this?  Turns out it's quite simple.  In this post, I'll show you how!


Calendar Events:


There are several different ways to add events to calendars.  However, they all boil down to sending a basic file with the information on the event within it.  These basic file types range from csv files to more calendar specific event files (such as ics).  Since there are so many different calendar platforms out there, most have been developed so that people can share events even if they are on different calendar platforms.  For example, I might use Microsoft Outlook and send a calendar event to a colleague who uses iCalendar.  iCalendar can easily accept an invite from the Microsoft calendar platform and vise versa.  


For this post, I decided to have SAS Visual Analytics create an .ics file as my calendar event to download.  Looking at the documentation on the ics file format, it looks like it is very simplistic.  For the above example, if you use a text editor to open the ics file downloaded in the NC State vs. Miami football game example, it looks like this:


SUMMARY: NC State vs. Miami
DESCRIPTION: NC State Football Game


It's a very simple 12-line text file.  So we need to get SAS Visual Analytics to CREATE this text file and fill in the values for what the user clicked on.  In order to create the text file, we will use a the SAS Stored Process Web App.  If you are unfamiliar with SAS Stored Process Web Apps, documentation on it can be found here.  Essentially, it allows one to call and run SAS Code from a browser.  So what we need is a program that will import the calendar event the user clicked on and then write out the text above as an ics file.


Writing the SAS Code to do this is not difficult.  I've attached a completed SAS program which can do this as a stored process.  The purpose of this post is to show how one can link the existing "2016 Football Season" report to the provided stored process (named: "Download ICS File").


Within the SAS Management Console, we can see the stored process "Download ICS File."  Let's take a look at its properties by right-clicking the file and selecting "Properties."




From the properties view, select the "Parameters" tab.  You will see two parameters listed:

  • Game_Date
  • Team




When the report user clicks a game on the Visual Analytics report, these are the two pieces of information that are passed to the stored process as "Input Parameters".  The stored process takes the values selected and uses this information to create the ICS file that is provided as the download.  The next step is to link the Stored Process to the Visual Analytics Report in such a fashion that the "Game_Date" and "Team" information is passed between the two.  To do so, follow the following steps:


First open your report "2016 Football Season" in SAS Visual Analytics Designer.  Right-click the table on the right and choose "Add Link" -> "External Link".




On the next window, select "Link to Stored Process":




From the next window, navigate to the folder where you imported the Stored Process included in this post and select "Download ICS File."  Press "Open."




The next window contains the most important part of this process.  You will see a "Parameters" section at the bottom of the window.  This window contains the Input Parameters we saw in the properties window of the stored process.  SAS Visual Analytics actually DETECTS the needed parameters for the Stored Process to run and lets us select columns from our report's data source to fill them.  Pretty sweet!  From the drop-downs, select "Game Date" and "Team".  Press OK:




And that's it!  That's all that's needed to link a SAS Visual Analytics Report to a SAS Stored Process.  However the REAL trick here is leveraging the Stored Processes' input parameters to create dynamic content from what the user selects.  Go ahead and save your report and open it up in the SAS Visual Analytics Viewer.  Click any game and click "External Link to Download ICS File":




Boom! The ICS file is dynamically created based upon the "Game Date" and "Team" selected and is downloaded.  Open or import it with your favorite calendar program:




How to Make the Example Work for You

This example was created in SAS Visual Analytics 7.3. Attached is a SAS package file containing the report and stored process (already linked together).  The data for the report in csv file format is also attached. Load the csv file into memory (specifically the built in "Visual Analytics LASR" LASR Library) on your SAS Visual Analytics instance and you will be able to import this package if you have access to the SAS Management Console 7.3. Please refer to these instructions.




If you do not have access, contact your SAS Visual Analytics Administrator. Be sure to select the report when importing.




Great post Mike! I've tried to use parameters using the Stored Process Object in the Report Designer and they aren't supported. This is a great technique to do what is needed. Thanks!

Version history
Last update:
‎02-03-2017 09:17 AM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags