<?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 How to catch sas error codes \ description in powershell? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-catch-sas-error-codes-description-in-powershell/m-p/918392#M44388</link>
    <description>&lt;P&gt;In a project named "Test.egp", there is a program called "missing_var" with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc means data=sashelp.class;
	class sex;
	var wieght;
run;
%put &amp;amp;syserr;&lt;/PRE&gt;&lt;P&gt;The value of&amp;nbsp;&amp;amp;syserr when running the code is 3000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get this value of 3000 in PowerShell when running the project.&lt;/P&gt;&lt;PRE&gt;$proj_full_path = "test.egp"                
$eg_guide_app = New-Object -comObject SASEGObjectModel.Application.8.1
$current_project = $eg_guide_app.Open($proj_full_path, "")
try{
    $current_project.run
}
catch{
    $err_num = &lt;FONT color="#FF0000"&gt;???&lt;/FONT&gt; &lt;FONT color="#339966"&gt;#(5000)&lt;/FONT&gt;
}
$current_project.Close()
$eg_guide_app.Quit()&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Feb 2024 12:53:38 GMT</pubDate>
    <dc:creator>lamp_1234</dc:creator>
    <dc:date>2024-02-29T12:53:38Z</dc:date>
    <item>
      <title>How to catch sas error codes \ description in powershell?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-catch-sas-error-codes-description-in-powershell/m-p/918392#M44388</link>
      <description>&lt;P&gt;In a project named "Test.egp", there is a program called "missing_var" with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc means data=sashelp.class;
	class sex;
	var wieght;
run;
%put &amp;amp;syserr;&lt;/PRE&gt;&lt;P&gt;The value of&amp;nbsp;&amp;amp;syserr when running the code is 3000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get this value of 3000 in PowerShell when running the project.&lt;/P&gt;&lt;PRE&gt;$proj_full_path = "test.egp"                
$eg_guide_app = New-Object -comObject SASEGObjectModel.Application.8.1
$current_project = $eg_guide_app.Open($proj_full_path, "")
try{
    $current_project.run
}
catch{
    $err_num = &lt;FONT color="#FF0000"&gt;???&lt;/FONT&gt; &lt;FONT color="#339966"&gt;#(5000)&lt;/FONT&gt;
}
$current_project.Close()
$eg_guide_app.Quit()&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 12:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-catch-sas-error-codes-description-in-powershell/m-p/918392#M44388</guid>
      <dc:creator>lamp_1234</dc:creator>
      <dc:date>2024-02-29T12:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch sas error codes \ description in powershell?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-catch-sas-error-codes-description-in-powershell/m-p/918472#M44391</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/464155"&gt;@lamp_1234&lt;/a&gt;&amp;nbsp;EG won't return any SAS error codes or log content directly in the script. To accomplish this, you will need to enhance your script to get the .Log object from the Code item that runs this PROC MEANS. Then you'll have to use PowerShell to scan the Log (a text object) for the error message/code you're looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need to add quite a bit of logic, and you can find some examples here:&amp;nbsp;&lt;LI-MESSAGE title="Doing More with SAS Enterprise Guide Automation" uid="417832" url="https://communities.sas.com/t5/SAS-Communities-Library/Doing-More-with-SAS-Enterprise-Guide-Automation/m-p/417832#U417832" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 19:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-catch-sas-error-codes-description-in-powershell/m-p/918472#M44391</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2024-02-29T19:28:37Z</dc:date>
    </item>
  </channel>
</rss>

