Hi, in SAS 8.5.1 I have 107 time series columns and I want to let the user plot one of them. To accomplish this, I use a select box with a parameter and a custom measure like this:
IF 'par1'p = "var1" RETURN 'var1'n ELSE IF 'par1'p = "var2" RETURN 'var2'n ELSE IF ... ELSE .
but I would like to know if there's a solution for this error that SAS VA pops up:
"The expression cannot be saved because an operator is nested too deeply. The current depth is 107 and the maximum depth is 100."
Thanks in advice,
Pierangelo
Restructuring the data would be the best approach and should yield some performance improvement, but yeah it should be possible to break up the chain of IF statements into chunks. For example, you might say something like:
(Not real code, obviously)
IF param startsWith "var1"
RETURN (
IF (param = "var1")
RETURN var1
ELSE IF (param = "var11")
RETURN var11
ELSE IF (param = "var12")
RETURN var12
....
)
ELSE IF (param startsWith "var2")
RETURN (
IF param = "var2"
RETURN var2
ELSE ...
)
An so on.
Hello,
There's a much easier solution (no coding in VA).
Transpose your table such that you have 3 columns:
(date)timestamp + Time Series identifier (name) + value.
Then put a list-selection-object with the unique / distinct Time Series identifiers / names. All time series identifiers will get a check box in front of them. Then link that list-selection-object with the time series plot with an action on object (filter action). You don't have to map any VA data sources on Time Series identifier (name) because you use the same data source for list-selection-object and time series plot.
In the Time Series plot you should group on Time Series identifier (name) to allow a different line for every identifier.
You can do a SELECT ALL / SELECT NONE (clear all) as well.
Kind regards,
Koen
On top of my previous reply (see above) ...
The Time Series plot has a default system limit (maximum number of rows it can use, maximum number of points it can display).
You can increase that system limit, but take care with doing that.
Read the following usage note to be aware of the possible implications of raising the limit.
Usage Note 62148: High cardinality thresholds in SAS® Visual Analytics 8.x
https://support.sas.com/kb/62/148.html
Cheers,
Koen
The 100-level limit on the nesting is fixed and cannot be modified.
-------------------------------------------------------------------------
Four tips to remember when you contact SAS Technical Support
Tricks for SAS Visual Analytics Report Builders
SAS Visual Analytics Learning Center
Perhaps logically it would be OK to remove one of the "ELSE"s in the middle, and turn this into two separate blocks of IF/THEN/ELSE.
Restructuring the data would be the best approach and should yield some performance improvement, but yeah it should be possible to break up the chain of IF statements into chunks. For example, you might say something like:
(Not real code, obviously)
IF param startsWith "var1"
RETURN (
IF (param = "var1")
RETURN var1
ELSE IF (param = "var11")
RETURN var11
ELSE IF (param = "var12")
RETURN var12
....
)
ELSE IF (param startsWith "var2")
RETURN (
IF param = "var2"
RETURN var2
ELSE ...
)
An so on.
Thanks @Astrid1,
Cheers
Markus
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.