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.
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:
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:
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).
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.