BookmarkSubscribeRSS Feed
Dee2
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.

3 REPLIES 3
Stu_SAS
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?
Dee2
Obsidian | Level 7

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

 

Dee2_0-1637334378149.png

 

Stu_SAS
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.

 

parameter.gif

 

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"

    title_parm.PNG
  3.  Add the parameter to a report control, such as a button bar:
    Stu_SAS_0-1637344322583.png

  4. Add the parameter to your text box:
    Stu_SAS_1-1637344431442.png

 

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:
    category.PNG
  2.  Go to Options, scroll to the bottom, and remove all labels except for the category value:
    keyvalue-options.PNG
  3. You now should have "Title" consisting only of the single category

    single-category-keyvalue.PNG

 

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:

 

Stu_SAS_2-1637345381917.png

 

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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1685 views
  • 1 like
  • 2 in conversation