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

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sam_SAS
SAS Employee

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.

View solution in original post

7 REPLIES 7
sbxkoenk
SAS Super FREQ

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

sbxkoenk
SAS Super FREQ

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

 

Madelyn_SAS
SAS Super FREQ

The 100-level limit on the nesting is fixed and cannot be modified. 

Astounding
PROC Star

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.

Sam_SAS
SAS Employee

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.

Astrid1
Calcite | Level 5

@MarkusWeick,

that should be interesting for you.

Cheers

Astrid

MarkusWeick
Barite | Level 11

Thanks @Astrid1,

Cheers

Markus

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 7 replies
  • 1316 views
  • 7 likes
  • 7 in conversation