<?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: Create in-memory table using user-defined action in SAS VIYA CASL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790705#M253178</link>
    <description>&lt;P&gt;there are some errors like the type statement for the table2 parameter.&lt;/P&gt;
&lt;P&gt;caslibs need to be assigned properly, no need for send_response construct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
builtins.defineActionSet / name ="myActSet2"
actions=
{
{
name="lsttblDet"
desc="Display Table Details"
parms={
{name="caslib" type="string" required=TRUE isCaslib=TRUE}
{name="table" type="string" required=TRUE}
{name="caslib2" type="string" required=TRUE isCaslib=TRUE}
{name="table2" type="string" required=TRUE}
}
definition="
table.tableDetails result=a /caslib=caslib table=table;
saveresult a caslib=caslib2 casout=table2;
"
}

};
quit;

cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");
caslib _all_ assign;

data casuser.cars;
set sashelp.cars;
run;

proc cas;
myActSet2.lsttblDet /
caslib='casuser' table='cars'
caslib2='casuser' table2='mytab';
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jan 2022 16:15:58 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2022-01-18T16:15:58Z</dc:date>
    <item>
      <title>Create in-memory table using user-defined action in SAS VIYA CASL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790680#M253171</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using SAS VIYA 3.5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anybody tried to define an in-memory table in the "&lt;EM&gt;definition&lt;/EM&gt;" parameter of "&lt;EM&gt;builtins.defineActionSet&lt;/EM&gt;"?&lt;/P&gt;
&lt;P&gt;(I am aware that the table can be created when we call the new custom CAS action using "savereresult" statement)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example in the following code I have tried to save the details of the table TBL in table CASUSER.TBL_RES&amp;nbsp; directly from the definition&amp;nbsp; of the new action set. I think that "send_response" highlighted in orange is not right. The error code I receive is below the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your suggestions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;smm662002&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc cas;&lt;BR /&gt;builtins.defineActionSet / name ="myActSet2"&lt;BR /&gt;actions=&lt;BR /&gt;{&lt;BR /&gt;{&lt;BR /&gt;name="lsttblDet"&lt;BR /&gt;desc="Display Table Details"&lt;BR /&gt;parms={&lt;BR /&gt;{name="caslib" type="string" required=TRUE isCaslib=TRUE}&lt;BR /&gt;{name="table" type="string" required=TRUE}&lt;BR /&gt;{name="caslib2" type="string" required=TRUE isCaslib=TRUE} &lt;BR /&gt;{name="table2" type="CASOUTTABLE" required=TRUE} &lt;BR /&gt;} &lt;BR /&gt;definition="&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.tableDetails result=a /caslib=caslib table=table;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;temp=findtable(a);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;saveresult temp caslib=caslib2 casout=table2;&lt;BR /&gt;&lt;FONT color="#FF9900"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;send_response(caslib2.table2);&lt;/FONT&gt;&lt;BR /&gt;"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;};&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;proc cas;&lt;BR /&gt;myActSet2.lsttblDet / &lt;BR /&gt;caslib=casuser table=TBL&lt;BR /&gt;caslib2=casuser table2=TBL_a;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="sasLogNote4_1642511418157" class="sasNote"&gt;NOTE: Active Session now DEMO.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning1_1642511418157" class="sasWarning"&gt;WARNING: Variable 'casuser' is uninitialized. It has been set to missing.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning2_1642511418157" class="sasWarning"&gt;WARNING: Variable 'cars' is uninitialized. It has been set to missing.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning3_1642511418157" class="sasWarning"&gt;WARNING: Variable 'cars_a2' is uninitialized. It has been set to missing.&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1642511418157" class="sasError"&gt;ERROR: Cannot convert parameter 'caslib' from double to string.&lt;/DIV&gt;
&lt;DIV id="sasLogError2_1642511418157" class="sasError"&gt;ERROR: The action stopped due to errors.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE id="pre_sasLog_2207" class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 13:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790680#M253171</guid>
      <dc:creator>smm662002</dc:creator>
      <dc:date>2022-01-18T13:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create in-memory table using user-defined action in SAS VIYA CASL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790705#M253178</link>
      <description>&lt;P&gt;there are some errors like the type statement for the table2 parameter.&lt;/P&gt;
&lt;P&gt;caslibs need to be assigned properly, no need for send_response construct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
builtins.defineActionSet / name ="myActSet2"
actions=
{
{
name="lsttblDet"
desc="Display Table Details"
parms={
{name="caslib" type="string" required=TRUE isCaslib=TRUE}
{name="table" type="string" required=TRUE}
{name="caslib2" type="string" required=TRUE isCaslib=TRUE}
{name="table2" type="string" required=TRUE}
}
definition="
table.tableDetails result=a /caslib=caslib table=table;
saveresult a caslib=caslib2 casout=table2;
"
}

};
quit;

cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");
caslib _all_ assign;

data casuser.cars;
set sashelp.cars;
run;

proc cas;
myActSet2.lsttblDet /
caslib='casuser' table='cars'
caslib2='casuser' table2='mytab';
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jan 2022 16:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790705#M253178</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-01-18T16:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create in-memory table using user-defined action in SAS VIYA CASL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790709#M253179</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;Thank you so much for your answer. Spot on.&lt;BR /&gt;Initially I tried with "string" type for table2 but I had a similar error hence I decided to change to "CASOUTTABLE".   &lt;BR /&gt;Would you have any additional documentation describing when to use the types "CASOUTTABLE" | "CASTABLE" | "CASVAR" | "PARAMLIST" ?&lt;BR /&gt;Also I had the impression that  send_response is always required but your answer is proving that I misunderstood it. &lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;smm662002</description>
      <pubDate>Tue, 18 Jan 2022 16:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790709#M253179</guid>
      <dc:creator>smm662002</dc:creator>
      <dc:date>2022-01-18T16:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create in-memory table using user-defined action in SAS VIYA CASL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790720#M253182</link>
      <description>&lt;P&gt;Hi, I share with you another more sophisticated example of defineactionset usage.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;give it a try, I get it working by trial and error, I do not have a documentation at hand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
builtins.defineActionSet / name="myActionSet"
actions={
{
name="listTableInfo"
desc="Return Information about a CAS Table"
parms={
{name="caslib" type="string" required=TRUE}
{name="table" type="string" required=TRUE}
}
definition="
table.tableInfo result= a / caslib=caslib table=table;
send_response(a);
"
}
{
name="detailfreq"
desc="Return Detailed Frequency and Tabulate Information"
parms={
{name="caslib" type="string" required=TRUE} {name="table" type="string" required=TRUE}
{name="var1" type="string" required=TRUE} {name="var2" type="string" required=TRUE}
}
definition="
freqtab.freqtab result=c/
table={caslib=caslib name=table},
tabulate={var1, var2,
{vars={var1, var2}}};
send_response(c);
"
}
{
name="corr"
desc="Generate a Matrix of Pearson Product-Moment correlation coefficients"
parms={
{name="caslib" type="string" required=TRUE} {name="table" type="string" required=TRUE}
{name="var1" type="string" required=TRUE} {name="var2" type="string" required=TRUE}
{name="var3" type="string" required=TRUE} {name="var4" type="string" required=TRUE}
}
definition="
simple.correlation result= d /
inputs={var1, var2}
pairwithinput={var3, var4}
table={caslib=caslib name=table};
send_response(d);
"
}
{
name="simplefreq"
desc="Return Simple Frequency Information"
parms={
{name="caslib" type="string" required=TRUE} {name="table" type="string" required=TRUE}
{name="var1" type="string" required=TRUE} {name="var2" type="string" required=TRUE}
}
definition="
simple.freq result=b /
inputs={var1, var2}
table={caslib=caslib name=table};
send_response(b);
"
}
};
run;



proc cas;

myActionSet.listTableInfo result=a/
caslib="akaike" table="cars";
print a;
myActionSet.simplefreq result=b/
caslib="akaike" table="cars" var1="Origin" var2="DriveTrain";
print b;
myActionSet.detailfreq result=C /
caslib="akaike" table="cars" var1="Origin" var2="type";
print c;
myActionSet.corr result=d /
caslib="akaike" table="cars" var1="MSRP" var2="Invoice"
var3="Horsepower" var4="MPG_City";
print d;
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 17:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-in-memory-table-using-user-defined-action-in-SAS-VIYA/m-p/790720#M253182</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-01-18T17:24:19Z</dc:date>
    </item>
  </channel>
</rss>

