Adding a Stored Process to SAS Visual Analytics
Not all data belongs in SAS Visual Analytics – it’s true. You may have situations where you want to filter and zoom on data and then look at the data in another system. Maybe it’s a list of items that the user wants to follow-up on in a different method. If you are using a non-distributed version of SAS Visual Analytics you may be particular about how much data does go into the system. In these cases a SAS Stored Process allows you to pass a parameter to another data set and output to HTML or even Excel.
Linking to a Stored Process
Let’s look at an example of how I envision this process working. In the following figure, I have two datasets: DSN1 and DSN2. DSN2 is a data set that contains all tweets during the past year about a particular hash tag. Many times when people are analyzing social media they are evaluating counts of tweets, counts of retweets, hashtags that are used, and so on. They are actually less interested in the tweet itself at first. Tweets can use a lot of space. Thus you don’t want all of that data in the LASR server- so you have a second data set called DSN1 that contains summarized information from the past week. However, when you do want to review the tweet text then its nice if you could retrieve the detailed data. You may decide to load the data in the Explorer for text analysis.
The following chart shows an overview of how the stored process is going to work. The key is having a common variable that is available in each data set. In this case the variable is author_id. When the user runs the stored process, it passes the selected author_id to the stored process so we can see all the tweets from that particular author.
Here’s an example of how it looks. When the user clicks on an author name a pop-up offers to show the tweets in Twitter or in a file. When the user selects Export data to a file, a web page opens with the selected authors’ tweets. You can also output to other formats such as CSV, Excel, PDF, RTF, and so on. Notice that the SAS Visual Analytics report object must have the author available to pass to the stored process. If the chart contains a list of tweet locations, then the author_id would not be available to pass to the stored process.
Setting Up Your Stored Process
Here’s a brief overview of how to recreate this process. For additional details about using stored processes, refer to the user guide for your release of SAS Visual Analytics.
- Create a stored process that uses the common variable in a where statement and use that as a prompt value. In this case author is my prompt.
Your stored process code should look similar to this code:
Here’s an example of how to use a dynamic where clause if you want to use the stored process for multiple queries. For instance if you wanted to select author, region, or hashtag, you first need to know what the user actually selected.
- Create a report in SAS Visual Analytics using the data set with the common variable, such as author or order_id. Your data object must contain the data item that will be used in the stored process. In the above stored process it was called author. In the following figure, you can see the bar chart lists the tweets by author.
- Right-click on the data object (bar chart, table, pie chart) and select Add Links > External Links.
- In the Create External Link window, select Link to stored process and find the stored process you created in Step 1 and associate the parameters from the data object with the prompt. Author is what is showing in my data object as the y-axis value so I can pass it to the prompt. The data item do not have to have the same name just the same value.Note: If your parameter is not shown, then select the Add a new parameter to create it.
- Click ok and test.
Have you used stored processes with your SAS Visual Analytics reports? Tell me about it in the comments below.
Never miss a BI Notes post!
Click here for free subscription. Once you subscribe you'll be asked to confirm your subscription through your email account. You email address is kept private and you can unsubscribe anytime.
Latest posts by Tricia Aanderud (see all)
- Seven Interesting Data Storytelling Examples - 2018-06-09
- Use Network Analysis to Understand Your Customers with SAS Visual Analytics 8.2 - 2018-01-21
- My 7 Favorite Features in SAS Visual Analytics 8.2 on Viya - 2018-01-14
- Designing Dashboards: Finding the Fantastic Five Colors - 2017-06-19
- Creating a Web Analytics Report in SAS Visual Analytics 8.1 - 2017-06-19