BookmarkSubscribeRSS Feed

Custom Task Tuesday: Sonification Using the SAS Graphics Accelerator

Started ‎03-10-2020 by
Modified ‎04-08-2020 by
Views 3,608

medium.jpg1571079347403.png

Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task AuthorThis paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.

 

I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.

 

For the second post in this mini-series we looked at one of the tasks from my paper that uses Sonification from the SAS Graphics Accelerator. In the paper, I used this task as an example for using the two optional task sections: Dependencies and Requirements.

The Sonification Task

This task enables the user to select a data set and create a graph that is sonifiable and supported by the SAS Graphics Accelerator. In order to use this task, you must have installed the SAS Graphics Accelerator Chrome browser extension.

 

 

From the SAS Graphics Accelerator Product Page:

SAS Graphics Accelerator enables users with visual impairments or blindness to create, explore, and share data visualizations. It supports alternative presentations of data visualizations that include enhanced visual rendering, text descriptions, tabular data, and interactive sonification. Sonification uses non-speech audio to convey important information about the graph.

The chart types available in the task are those that are supported by the SAS Graphics Accelerator. Here's what the task looks like:

Sonification Task.png

After you use the task to create a graph (and you have the SAS Graphics Accelerator Chrome Extension installed), you'll see a button that says "Accelerate." 

 

sonf.png

Clicking that button will open your graph in the SAS Graphics Accelerator, where you can listen to the sonification:graphiscs acceleratro.PNGNote: As stated in the Task Instructions, you can turn on the accessible graph options for all graphs by going to "Preferences">"Results">"Enable Accessible Graph Option." After doing this, you can use any of the built-in graph tasks or write your own SGPLOT code to take advantage of the SAS Graphics Accelerator (you don't have to use this Sonification Task).

 

 

The Dependencies Section

The Dependencies section is the first optional task section. It specifies how certain options (or controls) rely on one another in order for the task to work properly. The Dependencies section is infinitely useful because it enables you to show/hide and enable/disable one control based on the current value of another control. 

 

To create a dependency, you specify the dependency condition, the target control that you want to change if the condition is true, and the action that you want to take on the control if the condition is true. Action options include “show,” “hide,” “enable,” “disable,” and “set.”

 

Sonification Task Example

In the Sonification task, the Dependencies section is used to control which variable options appear for each chart type. For example, a bar chart requires only one variable (category) while a bubble plot requires three variables (x, y, and size). Here is the code for the Dependencies section:

<Dependencies>
   <Dependency condition="($comboTYPE == 'vbar' || $comboTYPE == 'hline' || $comboTYPE == 'pie')">
        <Target option="VAR" conditionResult="true"  action="show"/>
        <Target option="VAR" conditionResult="false" action="hide"/>
   </Dependency> 
   <Dependency condition="($comboTYPE == 'vbox' || $comboTYPE == 'histogram')">
        <Target option="NVAR" conditionResult="true"  action="show" />
        <Target option="NVAR" conditionResult="false" action="hide" />
   </Dependency> 
   <Dependency condition="($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter')">
        <Target option="XVAR" conditionResult="true"  action="show"/>
        <Target option="XVAR" conditionResult="false" action="hide"/>
        <Target option="YVAR" conditionResult="true"  action="show"/>
        <Target option="YVAR" conditionResult="false" action="hide"/>
    </Dependency>
    <Dependency condition="($comboTYPE == 'bubble')">
        <Target option="SIZEVAR" conditionResult="true"  action="show"/>
        <Target option="SIZEVAR" conditionResult="false" action="hide"/>
    </Dependency> 
</Dependencies>

 

The Requirements Section

The Requirements section is the second optional section. It specifies conditions for the task to run. If the condition has been met, then SAS code is generated. If the condition has not been met, the SAS code will not generate, and a message will be displayed. The Requirements section is not as widely used as the Dependencies section, but there are still times when it can come in handy.

 

To create a requirement, you specify the requirement condition and the message to be displayed if the requirement is not met. In most cases, it is easier to specify the condition that would fail the requirement and then negate it (by using the standard “!”), rather than specify the condition that would pass the requirement.

 

Sonification Task Example

In the Sonification task, the requirements are used to ensure that the user has selected the necessary variables for the chosen type. For example, if the user selects bar chart from the Chart Type combobox, we want to require that the category variable array is not empty. Here is the code for the Requirements section:

<Requirements>
   <Requirement condition="(!(($comboTYPE == 'vbar' || $comboTYPE == 'hline' || $comboTYPE == 'pie') &amp;&amp; ($VAR.size() == 0)))" >
<Message nlsKey="varSelectionMsgKey">Select a category variable.</Message>
   </Requirement> 
   <Requirement condition="(!(($comboTYPE == 'vbox' || $comboTYPE == 'histogram') &amp;&amp; ($NVAR.size() == 0)))">
<Message nlsKey="nvarSelectionMsgKey">Select an analysis variable.</Message>
   </Requirement> 
   <Requirement condition="(!(($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter') &amp;&amp; ($XVAR.size() == 0)))">
<Message nlsKey="xvarSelectionMsgKey">Select an X variable.</Message>
   </Requirement> 
   <Requirement condition="(!(($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter') &amp;&amp; ($YVAR.size() == 0)))">
<Message nlsKey="yvarSelectionMsgKey">Select a Y variable.</Message>
   </Requirement>
   <Requirement condition="(!(($comboTYPE == 'bubble') &amp;&amp; ($SIZEVAR.size() == 0)))">
      <Message nlsKey="sizevarSelectionMsgKey">Select a size variable.</Message>
   </Requirement>
</Requirements>

 

Check out the Task Tuesday GitHub

Download the Sonification Task from the Task Tuesday GitHub. Head over to view the code and try it out for yourself!

Take Me to GitHub!

Join the Conversation on Twitter

Twitter_bird_logo_2012.svg.pngUse the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!

Version history
Last update:
‎04-08-2020 12:56 PM
Updated by:

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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 Tags