BookmarkSubscribeRSS Feed
Obsidian | Level 7

My version of SAS Visual Analytics is 8.5.1.
I added a Text control in the report. It allows me to add Measure Data Roles but the column I wanted to add is a string which is a category.  What can I do about it? Thanks.

SAS Employee
Although there is not a way to directly add a categorical column to a text box, you can use parameters to add dynamic characters to text. Can you describe what you are trying to add in your text box? Can you provide a screenshot of your report or a simple example?
Obsidian | Level 7

I want to have the Target_Perid in the Text. Thanks.




SAS Employee

Thank you! Here are a few options.


Option 1: Parameters

Usually when titles need to be dynamic, the report will have controls for the user to select something, such as a year, category, etc. Parameters are associated with report controls and allow you to use that value they have selected in calculated items and text boxes. In other words, if a user selects 'Target Period 1' in a report control, your parameter's value is 'Target Period 1' and you can use it in conditional logic just like any other calculated item - plus, you can use them in text boxes regardless of whether they are character, numeric, or date.




To do this:

  1. Go to Data --> New Data Item --> Parameter
  2. In the pop-up window, give your parameter a name and select "Character"

  3.  Add the parameter to a report control, such as a button bar:

  4. Add the parameter to your text box:


That's all there is to it! If you're interested in dynamic text and parameters, check out my paper Mastering Parameters in SAS Visual Analytics.


Option 2: Key Values

The reason why you cannot add a category directly to a text box is because that category may have multiple values in a large dataset. For example, if a category had values "A," "B", and "C," the text box would not know which of the values to show. If this value is always just one category, you can use a Key Value to display it since they support multiple categories. To do this:

  1. Add a Key Value to your report and give it a role of a category:
  2.  Go to Options, scroll to the bottom, and remove all labels except for the category value:
  3. You now should have "Title" consisting only of the single category



Option 3: Getting the Numeric Parts 

If your single value has both text and numeric parts, such as "Target Period: 1," you can split out the numeric part of the data. This can be done within Visual Analytics using string functions, but it may be easier to do during data prep. If you grab the numeric parts, you can set their aggregation values to "Average," set decimal points to zero, then add them as measures to a text box. For example:




This one works great for things like years, quarters, times, dates, etc. I use this trick often for showing the date a piece of data has been pulled by grabbing the month, year, day, and SAS time of day formatted as a duration (though you can also use the Modified Date option within text as well, depending on your need).



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!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1 like
  • 2 in conversation