BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
TheAntithesis
Calcite | Level 5

I'm trying to make a time series plot based on a table with 5 columns: three character columns which determine where the data comes from and what it's about, the date the data was collected, and the value of some variable at that time.

I have three lists, one for each character column, which allow the user to choose which data to look at in a time series plot, as shown below.

What I haveWhat I have

When the user selects multiple items in the lists, SAS adds all of the values that satisfy the filter and displays the total in a single line.

What I want is for SAS to create one line for each possible combination of ticked items in the list to allow them to look at multiple sources of data at the same time. In this case, as there is 1 item selected in the first character column, 2 in the second and 2 in the third, I would like 1x2x2=4 lines, as shown below.

What I want, made in MS PaintWhat I want, made in MS Paint

I made the above image using MS Paint and an unrelated time series plot that uses multiple Measures, which is why the data is inconsistent.

 

So far, my best attempt at getting a multi-line time series plot was by transposing the table on the three character columns using PROC TRANSPOSE, uploading the modified dataset to CAS, then using the columns representing each combination of data sources in the "Measure" parameter of the time series plot.

 

Unfortunately, this doesn't allow the user to choose which columns are shown without access to editing mode, as I don't know how to get the user to choose which columns are put in the "Measure" parameter of a time series plot without editing the plot itself. If there is a way to let the user choose which columns to analyse in a time series plot, that would be an acceptable (albeit suboptimal) solution.

 

If you know SAS VIYA can't do this (or I need to use something other than a time series plot), please tell me so I can seek an alternative solution.

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Without knowing what your data looks like here is a possible solution with fake data.

The data for the example looks like this, as you can see I have two category columns, a date column and a value column.

Bruno_SAS_0-1688037774740.png

Steps:

  • Create a new graph object using "Custom Graph Builder". The custom graph contains a Time Series plot. This plot has two roles by default, add a third role of type Group.
  • Import the new custom graph into your object list.
  • Create a report page consisting of two List controls and the new custom graph timeseries plot
  • The two List controls take their values from someCategory and someSubCategory, I made both required
  • Assign each List control a parameter that supports multiple values
  • Create a new calculated Data Item using the Concatenate operator like so:
    Concatenate(Concatenate('someCategory'n, '/'), 'someSubCategory'n)
    Bruno_SAS_2-1688039278255.png
  • On the custom graph time series plot assign the proper roles, someDate for the X axis, someValue for the Y axis and the new concatCategories created above as the group 
  • On the custom graph time series plot add an advanced filter that will filter based on the selected values from the two List controls (the values are in the parameters), the filter looks like this (where the names to the right on the In operator are the parameter names):
    Bruno_SAS_1-1688038638965.png

     

The resulting report will look like this:

Bruno_SAS_3-1688039414489.gif

Give it a try

View solution in original post

1 REPLY 1
BrunoMueller
SAS Super FREQ

Without knowing what your data looks like here is a possible solution with fake data.

The data for the example looks like this, as you can see I have two category columns, a date column and a value column.

Bruno_SAS_0-1688037774740.png

Steps:

  • Create a new graph object using "Custom Graph Builder". The custom graph contains a Time Series plot. This plot has two roles by default, add a third role of type Group.
  • Import the new custom graph into your object list.
  • Create a report page consisting of two List controls and the new custom graph timeseries plot
  • The two List controls take their values from someCategory and someSubCategory, I made both required
  • Assign each List control a parameter that supports multiple values
  • Create a new calculated Data Item using the Concatenate operator like so:
    Concatenate(Concatenate('someCategory'n, '/'), 'someSubCategory'n)
    Bruno_SAS_2-1688039278255.png
  • On the custom graph time series plot assign the proper roles, someDate for the X axis, someValue for the Y axis and the new concatCategories created above as the group 
  • On the custom graph time series plot add an advanced filter that will filter based on the selected values from the two List controls (the values are in the parameters), the filter looks like this (where the names to the right on the In operator are the parameter names):
    Bruno_SAS_1-1688038638965.png

     

The resulting report will look like this:

Bruno_SAS_3-1688039414489.gif

Give it a try

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 374 views
  • 1 like
  • 2 in conversation