<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when using CALL EXECUTE with a CAS Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909599#M358752</link>
    <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;Quote from&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1blnvlvciwgs9n0zcilud6d6ei9.htm" target="_blank" rel="noopener"&gt;CALL EXECUTE Routine&lt;/A&gt;&amp;nbsp;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;TABLE class="xisDoc-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xisDoc-summaryText"&gt;This function is not supported in a DATA step that runs in CAS.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Sun, 24 Dec 2023 19:37:00 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-12-24T19:37:00Z</dc:date>
    <item>
      <title>Error when using CALL EXECUTE with a CAS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909588#M358748</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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 &lt;/SPAN&gt;&lt;CODE&gt;call execute&lt;/CODE&gt;&lt;SPAN&gt; routine.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a simplified version of a script that executes a simple macreo:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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=&amp;amp;param;
%mend test;

data mycas.test/sessref=mysess;
    set mycas.table;
    call execute ('%test(' || text || ')');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When attempting to use &lt;/SPAN&gt;&lt;CODE&gt;call execute&lt;/CODE&gt;&lt;SPAN&gt; on a CAS table, I encounter the following error:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Interestingly, when the &lt;CODE&gt;sessref=mysess&lt;/CODE&gt; option is removed from the &lt;CODE&gt;data&lt;/CODE&gt; statement, the code executes without errors:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mycas.test;
    set mycas.table;
    call execute ('%test(' || text || ')');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that there might be an issue related to the &lt;CODE&gt;sessref&lt;/CODE&gt; option when using &lt;CODE&gt;call execute&lt;/CODE&gt; with CAS tables. as the&amp;nbsp;&lt;CODE&gt;%test&lt;/CODE&gt; macro is defined properly and is accessible when&amp;nbsp;&lt;CODE&gt;sessref&lt;/CODE&gt; option is not in use.&lt;SPAN&gt;This option is being used to ensure that all processing is done in CAS to prevent unwanted data transfer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate any guidance or suggestions on how to resolve this issue.&amp;nbsp; thank you in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 16:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909588#M358748</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2023-12-24T16:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using CALL EXECUTE with a CAS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909599#M358752</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;Quote from&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1blnvlvciwgs9n0zcilud6d6ei9.htm" target="_blank" rel="noopener"&gt;CALL EXECUTE Routine&lt;/A&gt;&amp;nbsp;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;TABLE class="xisDoc-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xisDoc-summaryText"&gt;This function is not supported in a DATA step that runs in CAS.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sun, 24 Dec 2023 19:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909599#M358752</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-12-24T19:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using CALL EXECUTE with a CAS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909600#M358753</link>
      <description>&lt;P&gt;Oh, I see now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="flex-1 overflow-hidden"&gt;
&lt;DIV class="react-scroll-to-bottom--css-sfzql-79elbk h-full"&gt;
&lt;DIV class="react-scroll-to-bottom--css-sfzql-1n7m0yu"&gt;
&lt;DIV class="flex flex-col pb-9 text-sm"&gt;
&lt;DIV class="w-full text-token-text-primary" data-testid="conversation-turn-3"&gt;
&lt;DIV class="px-4 py-2 justify-center text-base md:gap-6 m-auto"&gt;
&lt;DIV class="flex flex-1 text-base mx-auto gap-3 md:px-5 lg:px-1 xl:px-5 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem] group final-completion"&gt;
&lt;DIV class="relative flex w-full flex-col lg:w-[calc(100%-115px)] agent-turn"&gt;
&lt;DIV class="flex-col gap-1 md:gap-3"&gt;
&lt;DIV class="flex flex-grow flex-col max-w-full"&gt;
&lt;DIV class="min-h-[20px] text-message flex flex-col items-start gap-3 whitespace-pre-wrap break-words [.text-message+&amp;amp;]:mt-5 overflow-x-auto" data-message-author-role="assistant" data-message-id="548791be-59d2-4546-981a-5bd38e042a3a"&gt;
&lt;DIV class="markdown prose w-full break-words dark:prose-invert light"&gt;
&lt;P&gt;Guess I'll have to find an alternative approach. One of the uses CAS tables.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for pointing that out.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 21:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909600#M358753</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2023-12-24T21:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using CALL EXECUTE with a CAS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909603#M358755</link>
      <description>&lt;P&gt;The explicit usage of sessref enforces that the data step executes in CAS.&lt;/P&gt;
&lt;P&gt;CAS doesn't support all functions and it also can't directly interact with the macro processor.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/casdspgm/p1eyivn5kal7qwn1drrdt71v21ml.htm" target="_self"&gt;&lt;SPAN&gt;Restrictions and Notable Behaviors for DATA Step Processing&lt;/SPAN&gt;&lt;/A&gt;,&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/lefunctionsref/n0aj01kzztrvbsn1dkum4us3sgqv.htm" target="_self"&gt;SAS CALL Routines and Functions That Are Not Supported in CAS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code will run if you remove the sessref portion from your data step&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1703455179690.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92054iEEF533A62EC3836C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1703455179690.png" alt="Patrick_0-1703455179690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have also a read of&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/vdmmlcdc/8.1/casdataam/p0qlpqt6uhyqhen17qyj6mc9shtp.htm" target="_self"&gt;Controlling DATA Step Processing&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1703456383669.png" style="width: 1036px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92055i56FDAE3153D85C16/image-dimensions/1036x57?v=v2" width="1036" height="57" role="button" title="Patrick_0-1703456383669.png" alt="Patrick_0-1703456383669.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;....unless of course you use an option like sessref that instructs the data step to run in CAS (and only in CAS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 22:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/909603#M358755</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-12-24T22:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using CALL EXECUTE with a CAS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/910729#M359133</link>
      <description>&lt;P&gt;Why is it important to execute this data step in CAS?&lt;/P&gt;
&lt;P&gt;CALL EXECUTE is a code generator and usually doesn't (couldn't) benfit from parallel processing.&lt;/P&gt;
&lt;P&gt;But there shoudn't be anything stopping you from creating/executing CAS compatible code from a CALL EXCUTE in SAS Compute data step.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 10:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-using-CALL-EXECUTE-with-a-CAS-Table/m-p/910729#M359133</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-01-06T10:30:50Z</dc:date>
    </item>
  </channel>
</rss>

