BookmarkSubscribeRSS Feed
cokeyng
Obsidian | Level 7

Hi all,

 

Is it possible to select variables or columns to include in an object like list table or crosstab? For example, I have a data set like this.

Attribute Name    Station    Size    Region     Value      Size_0_15   Size_16_40

Salaries               A             0_15   Region A   150000  167580        850789

Salaries               B             16_40 Region B   760785  167580        850789

 

When I filter the report with Station = A, I want the column Size_0_15 is displayed next to the Value, like:

Attribute Name             Station A              Size_0_15

Salaries                        150000                 167580

 

But when I filter it with Station = B, I want the column   Size_16_40 instead, like:

Attribute Name             Station B              Size_16_40

Salaries                        760785                 850789

 

Thanks in advance,

 

Cokey

 

 

 

 

3 REPLIES 3
Sam_SAS
SAS Employee

You can do this by using a calculated data item and a parameter.

 

I assume that you have a button bar or other filter control object that selects between Station A and Station B?

 

If you create a parameter and assign it to the control, then you can use the parameter value in your calculated item. The expression might look like this:

 

IF ( 'Parameter 1'p = 'Station A' )
  RETURN 'Size_0_15'n
  ELSE IF ( 'Parameter 1'p = 'Station B' )
    RETURN 'Size_16_40'n
ELSE ''

Now you can assign this calculated item to your objects.

 

Let us know if that helps,

Sam

cokeyng
Obsidian | Level 7

Hi Sam,

 

Thanks for the tips. This solved half of my problem.

 

The content of the different columns can be displayed using this formula, but the column header is not dynamic still. right?

 

Cokey

 

Sam_SAS
SAS Employee
The column label will always be the same, so you would need to choose a name that makes sense for both of the source columns. Maybe just "Size" here?

If the label of the selected column is important to your viewers, you could add a text object to provide an explanation:

"For Station A, sizes 0-15 are displayed. For Station B, sizes 16-40 are displayed."

Would that make sense?

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 938 views
  • 0 likes
  • 2 in conversation