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

Hello there,

 

I am currently facing an issue with a SAS script involving the use of CAS tables, and I would greatly appreciate your insights to help resolve the problem. 

 

The script creates a CAS session, defines a CAS library, creates a CAS table named "table" with a variable "text," defines a macro "test" that prints its parameter, and then applies the macro to each observation in the "table" CAS table using the call execute routine.

 

Here is a simplified version of a script that executes a simple macreo:

 

cas mysess;
libname mycas cas;

data mycas.table;
    length text $10;
    input text $;
    datalines;
This 
is
a 
sample
table
;
run;

%macro test(param);
    %put param=&param;
%mend test;

data mycas.test/sessref=mysess;
    set mycas.table;
    call execute ('%test(' || text || ')');
run;

 

 

When attempting to use call execute on a CAS table, I encounter the following error:

 

ERROR: The subroutine EXECUTE is unknown, or cannot be accessed. Check your spelling. Either it was not found in the path(s) of 
       executable images, or there was incorrect or missing subroutine descriptor information.
ERROR: The action stopped due to errors.

 

 

Interestingly, when the sessref=mysess option is removed from the data statement, the code executes without errors:

 

data mycas.test;
    set mycas.table;
    call execute ('%test(' || text || ')');
run;

 

 

It seems that there might be an issue related to the sessref option when using call execute with CAS tables. as the %test macro is defined properly and is accessible when sessref option is not in use.This option is being used to ensure that all processing is done in CAS to prevent unwanted data transfer.

 

I would appreciate any guidance or suggestions on how to resolve this issue.  thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

The explicit usage of sessref enforces that the data step executes in CAS.

CAS doesn't support all functions and it also can't directly interact with the macro processor. 

Restrictions and Notable Behaviors for DATA Step ProcessingSAS CALL Routines and Functions That Are Not Supported in CAS

If the data step can't execute in CAS then it will execute in Compute. But if you use sessref then you instruct SAS not to do so.

 

Your code will run if you remove the sessref portion from your data step

Patrick_0-1703455179690.png

 

This means of course that SAS will transfer the source data from CAS to Compute, execute single threaded under Compute and then write back the result to CAS - with all the impact this has on resource consumption and performance.

 

Have also a read of Controlling DATA Step Processing

Patrick_0-1703456383669.png

....unless of course you use an option like sessref that instructs the data step to run in CAS (and only in CAS).

 

View solution in original post

4 REPLIES 4
alisio_meneses
Quartz | Level 8

Oh, I see now.

 

Guess I'll have to find an alternative approach. One of the uses CAS tables.

 

Thanks for pointing that out. 

Patrick
Opal | Level 21

The explicit usage of sessref enforces that the data step executes in CAS.

CAS doesn't support all functions and it also can't directly interact with the macro processor. 

Restrictions and Notable Behaviors for DATA Step ProcessingSAS CALL Routines and Functions That Are Not Supported in CAS

If the data step can't execute in CAS then it will execute in Compute. But if you use sessref then you instruct SAS not to do so.

 

Your code will run if you remove the sessref portion from your data step

Patrick_0-1703455179690.png

 

This means of course that SAS will transfer the source data from CAS to Compute, execute single threaded under Compute and then write back the result to CAS - with all the impact this has on resource consumption and performance.

 

Have also a read of Controlling DATA Step Processing

Patrick_0-1703456383669.png

....unless of course you use an option like sessref that instructs the data step to run in CAS (and only in CAS).

 

LinusH
Tourmaline | Level 20

Why is it important to execute this data step in CAS?

CALL EXECUTE is a code generator and usually doesn't (couldn't) benfit from parallel processing.

But there shoudn't be anything stopping you from creating/executing CAS compatible code from a CALL EXCUTE in SAS Compute data step.

Data never sleeps

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 537 views
  • 4 likes
  • 4 in conversation