<?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 Insert custom code before and after submitted code - Hide from log in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-custom-code-before-and-after-submitted-code-Hide-from-log/m-p/693390#M37348</link>
    <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;EG 7.1&amp;nbsp; and adding some custom code before and after submitted code to get some additional SAS notes&lt;/P&gt;&lt;P&gt;as warnings as shown below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to hide all the code in the before and after block and just see a clean log when I submit actual code.&lt;/P&gt;&lt;P&gt;I tried to use nosource / nonotes system option but it is not working for some part of the code.&lt;/P&gt;&lt;P&gt;Is it possible to hide the before and after block code from log ?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* insert BEFORE submitted code   */
/* options nonotes nosource  */
%let var1 = something ;
%let var2 = something ;
%let var3 = something ;

%macro errors1 ;
filename LogFile temp;
Proc printto log=LogFile new;
run;
%mend errors1; 
%errors1 ;

/*end of insert before code*/



/******************************************************************************************/

/* Insert AFTER submitted code  */

/*following code gets additional warnings in my EG log */
%macro errors2 ;
/* Insert custom code after submitted code here */
proc printto;
run;
%let __NOTE_CHECK__ =is uninitialized|Invalid|MERGE statement has more than one
data set|values have been converted/*|Input data set is empty*/|W.D format|Missing
values were generated|Unknown|will be overwritten by|Division by zero|Format was to
small|truncated|ALERT_C|ALERT_P|ALERT_R  ;

data _null_   ;
 infile LogFile truncover lrecl=30000;
 input;
 length content$30000;
content=_infile_;
 /* Change ERROR \d-\d to ERROR: */
content = prxchange('s/ERROR( +\d+-\d+: +)/ERROR:\1/o', 1,content);
/* Change PRG-ERROR: to ERROR: for %m_adam_create special log*/
content = prxchange('s/^PRG-ERROR:/ERROR:\1/o', 1,content);
/* For alerts  */
if prxmatch ("m/ALERT_R|ALERT_C|ALERT_P/oi",content)&amp;gt;0 then do ;
if index (content, "small|truncated|ALERT_C|ALERT_P|ALERT_R")&amp;gt;0 then ex=1 ;  ;
if index (content, "if prxmatch")&amp;gt;0 then  ex=1 ; 
/*if index (content ,'if prxmatch') =0 then */
 if ex ne 1 then content = 'WARNING:' || content ;
end; 
/* for overwritten info */
if index (content,'INFO:') and index (content,'overwritten') then do ;
content = prxchange('s/^INFO:/ERROR:\1/o', 1,content);
end; 
/* Replace special notes with warning*/
 pattern = prxparse("/(?&amp;lt;=^NOTE:).+\b(&amp;amp;__NOTE_CHECK__)\b/o");
 if prxmatch(pattern, content) then do;
 content = prxchange('s/^NOTE: /WARNING: /o',1,strip(content));
end;
/* put log out*/
len=length(content);
putlog content $varying200. len;
run;
/* %symdel __NOTE_CHECK__; */ 
%mend errors2 ;

%errors2;

/* end of submit after code  */&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 class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 636px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50897iC4BD1BACD260808B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Oct 2020 05:18:37 GMT</pubDate>
    <dc:creator>chetan3125</dc:creator>
    <dc:date>2020-10-22T05:18:37Z</dc:date>
    <item>
      <title>Insert custom code before and after submitted code - Hide from log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-custom-code-before-and-after-submitted-code-Hide-from-log/m-p/693390#M37348</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;EG 7.1&amp;nbsp; and adding some custom code before and after submitted code to get some additional SAS notes&lt;/P&gt;&lt;P&gt;as warnings as shown below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to hide all the code in the before and after block and just see a clean log when I submit actual code.&lt;/P&gt;&lt;P&gt;I tried to use nosource / nonotes system option but it is not working for some part of the code.&lt;/P&gt;&lt;P&gt;Is it possible to hide the before and after block code from log ?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* insert BEFORE submitted code   */
/* options nonotes nosource  */
%let var1 = something ;
%let var2 = something ;
%let var3 = something ;

%macro errors1 ;
filename LogFile temp;
Proc printto log=LogFile new;
run;
%mend errors1; 
%errors1 ;

/*end of insert before code*/



/******************************************************************************************/

/* Insert AFTER submitted code  */

/*following code gets additional warnings in my EG log */
%macro errors2 ;
/* Insert custom code after submitted code here */
proc printto;
run;
%let __NOTE_CHECK__ =is uninitialized|Invalid|MERGE statement has more than one
data set|values have been converted/*|Input data set is empty*/|W.D format|Missing
values were generated|Unknown|will be overwritten by|Division by zero|Format was to
small|truncated|ALERT_C|ALERT_P|ALERT_R  ;

data _null_   ;
 infile LogFile truncover lrecl=30000;
 input;
 length content$30000;
content=_infile_;
 /* Change ERROR \d-\d to ERROR: */
content = prxchange('s/ERROR( +\d+-\d+: +)/ERROR:\1/o', 1,content);
/* Change PRG-ERROR: to ERROR: for %m_adam_create special log*/
content = prxchange('s/^PRG-ERROR:/ERROR:\1/o', 1,content);
/* For alerts  */
if prxmatch ("m/ALERT_R|ALERT_C|ALERT_P/oi",content)&amp;gt;0 then do ;
if index (content, "small|truncated|ALERT_C|ALERT_P|ALERT_R")&amp;gt;0 then ex=1 ;  ;
if index (content, "if prxmatch")&amp;gt;0 then  ex=1 ; 
/*if index (content ,'if prxmatch') =0 then */
 if ex ne 1 then content = 'WARNING:' || content ;
end; 
/* for overwritten info */
if index (content,'INFO:') and index (content,'overwritten') then do ;
content = prxchange('s/^INFO:/ERROR:\1/o', 1,content);
end; 
/* Replace special notes with warning*/
 pattern = prxparse("/(?&amp;lt;=^NOTE:).+\b(&amp;amp;__NOTE_CHECK__)\b/o");
 if prxmatch(pattern, content) then do;
 content = prxchange('s/^NOTE: /WARNING: /o',1,strip(content));
end;
/* put log out*/
len=length(content);
putlog content $varying200. len;
run;
/* %symdel __NOTE_CHECK__; */ 
%mend errors2 ;

%errors2;

/* end of submit after code  */&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 class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 636px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50897iC4BD1BACD260808B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 05:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-custom-code-before-and-after-submitted-code-Hide-from-log/m-p/693390#M37348</guid>
      <dc:creator>chetan3125</dc:creator>
      <dc:date>2020-10-22T05:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Insert custom code before and after submitted code - Hide from log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-custom-code-before-and-after-submitted-code-Hide-from-log/m-p/694075#M37371</link>
      <description>&lt;P&gt;Well, oddly, it seems to be working for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure that the very first line in your special BEFORE code is OPTIONS NONOTES NOSOURCE and that the very last line is OPTIONS NOTES SOURCE.&amp;nbsp; Also, make sure you have a semi-colon after your Options statements.&amp;nbsp; I couldn't see a semi-colon in the code you posted.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1603595995419.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51034iAD0DAFD69DBF7072/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1603595995419.png" alt="jimbarbour_0-1603595995419.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I do these things, the only thing I see from the special BEFORE code is a Options Nonotes Nosource which I think you just have to live with.&amp;nbsp; Here I'm using a simple Data step as my test code that runs after the special BEFORE code.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_1-1603596135833.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51035i95A6777ED6C52217/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_1-1603596135833.png" alt="jimbarbour_1-1603596135833.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2020 03:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-custom-code-before-and-after-submitted-code-Hide-from-log/m-p/694075#M37371</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-25T03:24:17Z</dc:date>
    </item>
  </channel>
</rss>

