<?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: Need to insert rows into work.temp inside of proc cas block in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815388#M10458</link>
    <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you for the reply. This is great! Now, the next issue is that I want to loop thru all of my CASLIBs...getting a list of all of the files and tables in my CASLIBs. It appears that the method above will not allow for appending to the work.files and work.tables. Any suggestions for this?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Ricky</description>
    <pubDate>Fri, 27 May 2022 10:59:33 GMT</pubDate>
    <dc:creator>rgreen33</dc:creator>
    <dc:date>2022-05-27T10:59:33Z</dc:date>
    <item>
      <title>Need to insert rows into work.temp inside of proc cas block</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/814478#M10451</link>
      <description>&lt;P&gt;I am working on a script that will scan my caslibs and will report to me the datasets that are not loaded. &amp;nbsp;The code works (email portion lacking). &amp;nbsp;However, I can only "print" my results. &amp;nbsp;I need to get them into work.temp so that I can query them for email. &amp;nbsp;Below is my code. &amp;nbsp;I have tried everything that I can think of, but I cannot find a way to do an insert inside of my proc cas block.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;options emailsys=smtp symbolgen mprint mlogic timezone='america/new_york' options msglevel=i;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/* start cas session */&lt;/DIV&gt;&lt;DIV&gt;cas mySession sessopts=(messagelevel=all);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/* assign all caslibs, so that any can be used */&lt;/DIV&gt;&lt;DIV&gt;caslib _all_ assign;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc datasets library=work kill; run; quit;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc sql;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;create table work.temp (myCaslib char(255), myFilename char(255), myMessage char(255));&lt;/DIV&gt;&lt;DIV&gt;quit;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc cas;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%let myCaslib = "PUBLIC";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* Lists the files in a caslib's data source. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;table.fileinfo result=fileresult caslib=&amp;amp;myCaslib;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* Display the results of the above action; */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* Describe(fileresult); */&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;filelist=findtable(fileresult);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;do j over filelist;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;table.tableexists result=r / name=j.name caslib=&amp;amp;myCaslib;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;if r=0 then print &amp;amp;myCaslib " " (j.name) " : Dataset not loaded.";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;/********************************************************&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;Need help here. &amp;nbsp;Instead of the above print, I would like to&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;write the 3 print items to work.temp. &amp;nbsp;How can I do this within&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;this proc cas block?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;*********************************************************/&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/DIV&gt;&lt;DIV&gt;quit;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/* Email message with dynamic content based on data */&lt;/DIV&gt;&lt;DIV&gt;filename msg email&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;to="myEmail@mydomain.com"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;from="sas-alerts@mydomain.com"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;subject = "SAS Viya Dataset NOT Loaded";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data _null_;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;file msg;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;put "This is a test of email from Viya.";&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Fri, 20 May 2022 18:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/814478#M10451</guid>
      <dc:creator>rgreen33</dc:creator>
      <dc:date>2022-05-20T18:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need to insert rows into work.temp inside of proc cas block</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815111#M10457</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=work kill; run; quit;
cas mySession;
proc cas;
     %let myCaslib = PUBLIC;
      /* Lists the files in a caslib's data source. */
     table.fileinfo  result=fileresult / caslib="&amp;amp;myCaslib";
     files=findtable(fileresult);
     saveresult files dataout=work.files; 

     table.tableinfo  result=tableresult / caslib="&amp;amp;myCaslib";
     tables=findtable(tableresult);
     saveresult tables dataout=work.tables; 

quit;
cas mysession terminate;

proc sql;
create table work.notloaded as
select "&amp;amp;myCaslib"  as myCaslib
      ,f.Name as myFileName
      ,catx(" ",f.name,": Dataset not loaded") as myMessage 
   from work.files as f
   where f.Name not in (select SourceName from work.tables);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 May 2022 21:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815111#M10457</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-05-25T21:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need to insert rows into work.temp inside of proc cas block</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815388#M10458</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you for the reply. This is great! Now, the next issue is that I want to loop thru all of my CASLIBs...getting a list of all of the files and tables in my CASLIBs. It appears that the method above will not allow for appending to the work.files and work.tables. Any suggestions for this?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Ricky</description>
      <pubDate>Fri, 27 May 2022 10:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815388#M10458</guid>
      <dc:creator>rgreen33</dc:creator>
      <dc:date>2022-05-27T10:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to insert rows into work.temp inside of proc cas block</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815702#M10460</link>
      <description>&lt;P&gt;Just use the result set from&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_013/caspg/cas-table-caslibinfo.htm" target="_self"&gt;table.caslibInfo&lt;/A&gt;&amp;nbsp;and your original DO OVER technique to create a new work.xxx table for each caslib, then use PROC APPEND to the individual work datasets to a master list.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 14:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Need-to-insert-rows-into-work-temp-inside-of-proc-cas-block/m-p/815702#M10460</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-05-30T14:37:29Z</dc:date>
    </item>
  </channel>
</rss>

