<?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: SASPy submit result of running .sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956331#M373454</link>
    <description>&lt;P&gt;Yes, in fact, I do know HOW. I wrote SASPy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, I've had to enhance how I was doing that a couple of times over the years to account for SAS idiosyncrasies, like having text between the ERROR and the :, and for cases where logging has been enhanced by the user such that the log contains other formatted content, like timestamps and pids and stuff either before or after the SAS log output - so ERROR isn't even in column 1 of the log I get back. Lots of crazy stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the check:&lt;BR /&gt;&lt;BR /&gt;if re.search(r'\nERROR[ \d-]*:', logd): &lt;BR /&gt;&amp;nbsp; &amp;nbsp;warnings.warn("Noticed 'ERROR:' in LOG, you ought to take a look and see if there was a problem") &lt;BR /&gt;&amp;nbsp; &amp;nbsp;self._sb.check_error_log = True &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, SAS was never completely consistent, like a regular programming language where you call a function and check a return code, regarding programmatically being able to asses the results from submitted code. As others have mentioned, sometimes you can see ERROR: in the log and there wasn't really an error that kept things from working. Sometimes something doesn't work and you don't get ERROR. WARNING can't preclude something not working, or prove it did. The system Macros like SYSERR SYSINFO and all the others, aren't 100% reliable. All that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I try my best to provide these things so you can have the best chance of programmatically assessing your code. The best advice may be to only submit 1 SAS step of code at a time and use whichever method (Error check, Macro, ...) that works best for assessing that step, instead of submitting a whole program full of stuff and trying to assess all of it. Note you can also do things like, after a data step, check to see if the table exists and it has the number of rows expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SASPy is used in house for testing and that testing is automated and self assessing, using these various means to assess whether the code passed or failed. I wish there was simply one return code you could check for any SAS code you submit, but there isn't.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 17:27:03 GMT</pubDate>
    <dc:creator>sastpw</dc:creator>
    <dc:date>2025-01-16T17:27:03Z</dc:date>
    <item>
      <title>SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955838#M373270</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I just wonder if I use SASpy library submit method to run .sas code in a SAS server, how should I know that the .sas code run successfully or not?&amp;nbsp; Especially in automatic scheduling job using SASpy to run .sas code. Thanks!&lt;/P&gt;&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sun, 12 Jan 2025 09:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955838#M373270</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-12T09:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955848#M373277</link>
      <description>Is the SAS Server running SAS Grid?  Is this Linux or Windows?</description>
      <pubDate>Sun, 12 Jan 2025 18:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955848#M373277</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-01-12T18:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955866#M373287</link>
      <description>&lt;P&gt;1)&lt;/P&gt;
&lt;P&gt;Check the LOG file generated by .sas file . In it ,if there are not any ERROR or WARNING message, then .sas is running successfully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)&lt;/P&gt;
&lt;P&gt;Check OS return code:&lt;/P&gt;
&lt;PRE&gt;[sasuser2@sas1 scripts]$ ls -l
total 4
-rwxr-xr-x 1 sasuser2 sasusers 1125 Nov 28 17:10 remote_ifre.sh
[sasuser2@sas1 scripts]$ cat remote_ifre.sh
#!/bin/bash
SERVER1=10.7.70.39
SERVER1_PORT=22
SERVER1_USER=ifre1

SERVER2=10.7.70.40
SERVER2_PORT=22
SERVER2_USER=ifre1

#nc -z -w 2 ${SERVER1} ${SERVER1_PORT}
(sleep 1;)|telnet ${SERVER1} ${SERVER1_PORT} 2&amp;gt;&amp;amp;1|grep 'Escape character' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1
if [ $? -eq 0 ];then
    echo "[+] ${SERVER1} detection successful."
    ssh ${SERVER1_USER}@${SERVER1} 'sh /data/ifre1/ifre.sh'
    if [ &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;$? -eq 0&lt;/STRONG&gt; &lt;/FONT&gt;];then
        echo "[+] Script exec success on ${SERVER1}."
    else
        echo "[+] Script exec failed on ${SERVER1}."
    fi
&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2025 01:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955866#M373287</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-13T01:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955962#M373307</link>
      <description>&lt;P&gt;take a look at this part of the doc and see if it answers your question:&lt;BR /&gt;&lt;A href="https://sassoftware.github.io/saspy/advanced-topics.html#automatic-checking-for-error-in-the-log-and-the-warnings-module" target="_blank"&gt;https://sassoftware.github.io/saspy/advanced-topics.html#automatic-checking-for-error-in-the-log-and-the-warnings-module&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 20:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955962#M373307</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2025-01-13T20:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955963#M373308</link>
      <description>&lt;P&gt;Also, you can access the SAS automatic macro variables as needed to check them:&lt;BR /&gt;&lt;A href="https://sassoftware.github.io/saspy/api.html#saspy.sasbase.SASsession.SYSERR" target="_blank"&gt;https://sassoftware.github.io/saspy/api.html#saspy.sasbase.SASsession.SYSERR&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;as well as any macro variable using symget().&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 20:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955963#M373308</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2025-01-13T20:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955977#M373312</link>
      <description>&lt;P&gt;Thanks! It is non-grid SAS server running on Windows platform.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 00:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955977#M373312</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-14T00:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955978#M373313</link>
      <description>&lt;P&gt;Thanks for your comments! I think it's better to search "ERROR" in latest SAS log file. However I don't know whether the WARNING message is really error.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 00:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955978#M373313</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-14T00:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955979#M373314</link>
      <description>Yes. I think WARN msg is also another type of ERROR .&lt;BR /&gt;E.X. the LOG would display WARNING message:  the length of variables from two datasets is different , that would lead to the value of variable be truncated .</description>
      <pubDate>Tue, 14 Jan 2025 00:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/955979#M373314</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-14T00:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956024#M373337</link>
      <description>&lt;P&gt;Thanks! This enhancement is convenient for us to catch ERROR through SASpy.&amp;nbsp; Only&amp;nbsp;&lt;SPAN&gt;check_error_log&amp;nbsp; method is called to verified. User doesn't need to check log file himself. As the document points out, there is no perfect solution to know whether it's a real problem there. From automatic SAS job scheduling perspective,&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;if we find there is ERROR in log file, no matter it's checked through check_error_log or ourselves, we can just report that scheduling job failed and let user to verify in further steps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 09:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956024#M373337</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-14T09:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956026#M373338</link>
      <description>&lt;P&gt;Thanks! Use SYSERR macro is helpful if SAS or user defined procedures or steps write return code to syserr. From my understanding, it not as useful as checking ERROR in SAS log file.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 09:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956026#M373338</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-14T09:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956027#M373339</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; I agree with you. If one WARNING message indicates a logic error problem, we can think it's an error. But if that WARNING is an error, why not report it as ERROR directly. There should be some cases of WARNING which are not errors. How do we distinguish them during automatic scheduling jobs?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 09:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956027#M373339</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-14T09:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956143#M373381</link>
      <description>Nope. ERROR  stands for your code have some error or is unable to execute it, but WARN is saying your code could perform sucessfully but could yield wrong result/output .&lt;BR /&gt;For example:&lt;BR /&gt;NOTE: An infinite likelihood is assumed in iteration 0 because of a nonpositive residual variance estimate.&lt;BR /&gt;WARNING: Stopped because of infinite likelihood.&lt;BR /&gt;NOTE: The above message was for the following BY group:&lt;BR /&gt;      SampleID=1&lt;BR /&gt;&lt;BR /&gt;Although your code could running but the model is not fittable or result is not trusted.&lt;BR /&gt;All you need to do is keeping LOG clearn to make result trust or correct.</description>
      <pubDate>Wed, 15 Jan 2025 01:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956143#M373381</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-15T01:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956289#M373441</link>
      <description>&lt;P&gt;Thanks! I agree with you. For automatica SAS job scheduling, if there are ERRORs or WARNINGs in the sas log file, it should report the job is failed to notify user something wrong there.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 08:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956289#M373441</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-16T08:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956327#M373453</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143096"&gt;@sastpw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;take a look at this part of the doc and see if it answers your question:&lt;BR /&gt;&lt;A href="https://sassoftware.github.io/saspy/advanced-topics.html#automatic-checking-for-error-in-the-log-and-the-warnings-module" target="_blank" rel="noopener"&gt;https://sassoftware.github.io/saspy/advanced-topics.html#automatic-checking-for-error-in-the-log-and-the-warnings-module&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you know HOW the saspy code is doing this check?&amp;nbsp; I have seen a lot of lazy log scanners that just search for the letters ERROR in the log and so flag CODE that is there to potentially write an error message when an issue is detected causing many false positives.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you are searching for ERROR: as the note says then there are some error messages that SAS writes where there is other text between the end of ERROR and the colon character.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 16:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956327#M373453</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-16T16:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956331#M373454</link>
      <description>&lt;P&gt;Yes, in fact, I do know HOW. I wrote SASPy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, I've had to enhance how I was doing that a couple of times over the years to account for SAS idiosyncrasies, like having text between the ERROR and the :, and for cases where logging has been enhanced by the user such that the log contains other formatted content, like timestamps and pids and stuff either before or after the SAS log output - so ERROR isn't even in column 1 of the log I get back. Lots of crazy stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the check:&lt;BR /&gt;&lt;BR /&gt;if re.search(r'\nERROR[ \d-]*:', logd): &lt;BR /&gt;&amp;nbsp; &amp;nbsp;warnings.warn("Noticed 'ERROR:' in LOG, you ought to take a look and see if there was a problem") &lt;BR /&gt;&amp;nbsp; &amp;nbsp;self._sb.check_error_log = True &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, SAS was never completely consistent, like a regular programming language where you call a function and check a return code, regarding programmatically being able to asses the results from submitted code. As others have mentioned, sometimes you can see ERROR: in the log and there wasn't really an error that kept things from working. Sometimes something doesn't work and you don't get ERROR. WARNING can't preclude something not working, or prove it did. The system Macros like SYSERR SYSINFO and all the others, aren't 100% reliable. All that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I try my best to provide these things so you can have the best chance of programmatically assessing your code. The best advice may be to only submit 1 SAS step of code at a time and use whichever method (Error check, Macro, ...) that works best for assessing that step, instead of submitting a whole program full of stuff and trying to assess all of it. Note you can also do things like, after a data step, check to see if the table exists and it has the number of rows expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SASPy is used in house for testing and that testing is automated and self assessing, using these various means to assess whether the code passed or failed. I wish there was simply one return code you could check for any SAS code you submit, but there isn't.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 17:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956331#M373454</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2025-01-16T17:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956335#M373457</link>
      <description>&lt;P&gt;So it looks like you are check for ERROR: starting in first column (or in your case immediately following linefeed) which means we don't need to write the kind of crazy code I have seen to avoid having ERROR: appear in the code that is echoed to the long.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Things like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %str(ERR)OR: Macro parameter invalid.;
put 'ERR' 'OR: Value out of range.';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2025 18:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956335#M373457</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-16T18:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956336#M373458</link>
      <description>&lt;P&gt;Not sure what that code is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, the example I showed was from one of the access methods that doesn't have the issue with user content showing up embedded prior to the actual SAS log line (I think it was IOM). The STDIO access method has to deal with that, and in it the check has to deal with that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;def _checkLogForError(self, log):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;lines = re.split(r'[\n]\s*', log)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;for line in lines:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if re.search(r'^ERROR[ \d-]*:', line[self._sb.logoffset:]):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (True)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return (False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have some code where this isn't doing what you need?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 18:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956336#M373458</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2025-01-16T18:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956338#M373460</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143096"&gt;@sastpw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Not sure what that code is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, the example I showed was from one of the access methods that doesn't have the issue with user content showing up embedded prior to the actual SAS log line (I think it was IOM). The STDIO access method has to deal with that, and in it the check has to deal with that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;def _checkLogForError(self, log):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;lines = re.split(r'[\n]\s*', log)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;for line in lines:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if re.search(r'^ERROR[ \d-]*:', line[self._sb.logoffset:]):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (True)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return (False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have some code where this isn't doing what you need?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not talking about scanning the actual code. Just the SAS log itself. SAS logs echo the code, unless the user mistakenly set the NOSOURCE option.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 19:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956338#M373460</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-16T19:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956376#M373464</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143096"&gt;@sastpw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Not sure what that code is.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;Do you have some code where this isn't doing what you need?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't really use SASPy but if you want to test if your logic makes the same mistakes as some of the other code scanners I was complaining about try running this program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Check if AGE is missing ;
data _null_;
  set sashelp.class;
  if missing(age) then put 'ERROR: Age is missing for ' name= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You should get this as the LOG&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    * Check if AGE is missing ;
2    data _null_;
3      set sashelp.class;
4      if missing(age) then put 'ERROR: Age is missing for ' name= ;
5    run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.10 seconds
      cpu time            0.06 seconds
&lt;/PRE&gt;
&lt;P&gt;And it should NOT be flagged as having an error.&lt;/P&gt;
&lt;P&gt;Then try modifying the code so that it does print the error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.class;
  if _n_=2 then call missing(age);
  if missing(age) then put 'ERROR: Age is missing for ' name= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Display Manger will show the error message in RED.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1737074054659.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103767i21851487A4D4A129/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1737074054659.png" alt="Tom_0-1737074054659.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And your error check code should also find that error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 00:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956376#M373464</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-17T00:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy submit result of running .sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956617#M373511</link>
      <description>&lt;P&gt;Thanks for the comments! Excellent explanation!&amp;nbsp; Would SASpy also provide another flag like?&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="n"&gt;check_warning_log&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Thus, if either of&amp;nbsp;&lt;SPAN class="n"&gt;check_warning_log or check_error_log is true,&amp;nbsp; user can consider that the SAS program is not run smoothly.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="n"&gt;From my perspective, we use Automation tool to schedule the .sas programs which are written by others. It's not easy to change the existing .sas program files to add additional checks on each data step.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2025 22:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-submit-result-of-running-sas-code/m-p/956617#M373511</guid>
      <dc:creator>Frank09</dc:creator>
      <dc:date>2025-01-19T22:29:47Z</dc:date>
    </item>
  </channel>
</rss>

