Hi,
I am trying to write a DS2 code in RTDM. This is because I am not able to use Tableselect in calculated variables because FINDW function is not available. I cannot use FIND because I have to find the exact match.
Is there a limit on DS2 code based on the errors below? Or is there any alternative for this? Basically, I'm trying to filter the data grid in such a way that it will only output those that meet the condition. Thank you.
Sample1
PARAMETER - "DEVICE_X|DEVICE_Y|DEVICE_Z" (constant value, extracted from DB table)
CHECK - "DEVICE" (dynamic value and 1 customer can have multiple values, from the source data grid)
Output should be 0
FINDW(PARAMETER, CHECK) = 0 is true (this should not be part of the data grid output)
Sample2
PARAMETER - "DEVICE_X|DEVICE_Y|DEVICE_Z" (constant value, extracted from DB table)
CHECK - "DEVICE_X" (dynamic value and 1 customer can have multiple values, from the source data grid)
Output should be > 0
FINDW(PARAMETER, CHECK) > 0 is true (this should be part of the data grid output)
My source data grid has 195 columns and I have to output the same columns plus a new column that was calculated from the FINDW function. FINDW is working in the code, but when I output all the columns I am hitting error. I added columns by batch in the script to see where it is failing. Some columns are okay, and some columns are hitting below error.
com.sas.analytics.ph.RTDMException: Error executing activity
at com.sas.rtdm.implementation.EventExecutor.execute(EventExecutor.java:255)
at com.sas.rtdm.implementation.TestExecutor.execute(TestExecutor.java:209)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:58)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:18)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:89)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 8187
at java.lang.String.charAt(String.java:658)
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding.tokenize(DS2ObjectEncoding.java:494)
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding._decodeTableStr(DS2ObjectEncoding.java:352)
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding.decodeTableStr(DS2ObjectEncoding.java:296)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.getOutputValues(DS2Activity.java:439)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.handle_output(DS2Activity.java:316)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.execute(DS2Activity.java:228)
at com.sas.rtdm.implementation.EventExecutor.execute(EventExecutor.java:243)
... 9 more
This is excerpt from the code
package CHECK_PARAM/overwrite=yes;
dcl varchar(100) VAR58 /*sample column that hits error*/
/*Load data*/
DATAGRID_2.add_row();
DATAGRID_2.setString('VAR58 ',i_row,VAR58);
Also, when I try to process more than 2 rows, I am hitting this error "Not enough tokens" / java.util.NoSuchElementException
2023-09-12 16:44:26,409 WARN sasdemo SASDSDesignRepository Test Case 4 com.sas.rtdm.implementation.TestExecutor - Execution faulted:
Not enough tokens. Encoded data: "t560194
com.sas.analytics.ph.RTDMException: java.util.NoSuchElementException
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding.decodeTableStr(DS2ObjectEncoding.java:299)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.getOutputValues(DS2Activity.java:439)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.handle_output(DS2Activity.java:316)
at com.sas.rtdm.implementation.activity.sasactivity.DS2Activity.execute(DS2Activity.java:228)
at com.sas.rtdm.implementation.EventExecutor.execute(EventExecutor.java:243)
at com.sas.rtdm.implementation.TestExecutor.execute(TestExecutor.java:209)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:58)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:18)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:89)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.NoSuchElementException
at java.util.LinkedList.removeFirst(LinkedList.java:270)
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding._decodeTableStr(DS2ObjectEncoding.java:402)
at com.sas.rtdm.implementation.activity.sasactivity.DS2ObjectEncoding.decodeTableStr(DS2ObjectEncoding.java:296)
... 13 more
Appreciate feedback on this. Thank you
Home > SAS staff only here! > Employee Lounge
Employees: Where to get YOUR SAS user questions answered?
by BerverlyBrown
https://communities.sas.com/t5/Employee-Lounge/Employees-Where-to-get-YOUR-SAS-user-questions-answer...
Koen
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.