<?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: If else call execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228557#M41289</link>
    <description>&lt;P&gt;You need to expand the "plus" as else you're hiding the relevant parts of the log.&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/399iCCE1DD0B09B6E93A/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for the code you've posted: I can run it without errors as long as the files listed in "output_files.txt"&amp;nbsp;files exist.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Oct 2015 00:21:40 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2015-10-06T00:21:40Z</dc:date>
    <item>
      <title>If else call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228401#M41264</link>
      <description>&lt;P&gt;I've a code like below and it seems to be running as excepted. However, I could see a error message in SAS log for some reasons which I could not figure out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data log.output_file ;
  infile "&amp;amp;path/output_file.txt" firstobs=2 truncover ;
  input fname $400. ;
run;


%macro sas_log_analysis;
data log.log_analysis;
set log.output_file;
filename=fname;
length fname $400;
infile dummy dsd truncover FILEVAR = fname END = end_of_file LRECL=32000;
DO WHILE (not end_of_file);
input var : $ 3000.;
/*filename=fname;*/
var1 = _infile_;
if var1 = :'201' then do;
Date_TimeStamp= scan(var1,1," ");
output;
end;
end;
%mend sas_log_analysis;

%macro java_log_analysis;
data java;
set sashelp.class;
run;
%mend java_log_analysis;

%macro dotnet_log_analysis;
data dotnet;
set sashelp.class;
run;
%mend dotnet_log_analysis;


data _null_;
  set log.output_file;
  if fname =: '/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer' then call execute ('%sas_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_java' then call execute ('%java_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_dotnet' then call execute ('%dotnet_log_analysis;');
else put 'no log files';
run;

data _null_;
  set log.output_file;
  if fname =: '/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer' then call execute ('%sas_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_java' then call execute ('%java_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_dotnet' then call execute ('%dotnet_log_analysis;');
else put 'no log files';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log.output_file has records like follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fname&lt;BR /&gt;/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-10-04_19142.log&lt;BR /&gt;/usr/sas/tir/test/loganalysis/temp_java.log&lt;BR /&gt;/usr/sas/tir/test/loganalysis/temp_dotnet.log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For testing purpose, I've created a empty log files as&amp;nbsp;&lt;SPAN&gt;temp_java.log and&amp;nbsp;temp_dotnet.log. Could someone tell me that these two empty log files are root cause for the error?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: There were 5472 observations read from the data set LOG.LOG_ANALYSIS.
NOTE: The data set WORK.LOG_TABLE_FINAL has 5472 observations and 7 variables.
NOTE: The PROCEDURE REPORT printed pages 1-406.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           5.47 seconds
      cpu time            5.43 seconds
      

13        + close;  ods listing;  ods listing close;;
14        + data java;  set sashelp.class;  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
&amp;#12;12                                                         The SAS System                              06:17 Monday, October 5, 2015

NOTE: The data set WORK.JAVA has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

14        +                                     ;
15        + data dotnet;  set sashelp.class;  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.DOTNET has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

15        +                                       ;
267        

ERROR: Errors printed on page 6.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Oct 2015 10:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228401#M41264</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T10:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: If else call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228419#M41270</link>
      <description>Hi, it looks like you have cut out the key portion of your log (log line 16 through 266 are missing). If you would at those lines, you should see an ERROR: message. If you need help understanding the message, please post that section of the log.</description>
      <pubDate>Mon, 05 Oct 2015 13:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228419#M41270</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-10-05T13:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: If else call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228471#M41273</link>
      <description>I did not missed anything between  the lines16 to 276 as I copy/paste it from log window. Nothing in between the line 15 and 265. I don't see any error before that.</description>
      <pubDate>Mon, 05 Oct 2015 17:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228471#M41273</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T17:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: If else call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228474#M41274</link>
      <description>Well, then I'm flummoxed. You mean the log skips from line 15 to line 267? Are you submitting this code via EG? If so, suggest you turn on the options to the EG-added wrapper code. Also suggestion you turn on options mprint and source2. SAS clearly thinks it printed an error somewhere.</description>
      <pubDate>Mon, 05 Oct 2015 17:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228474#M41274</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-10-05T17:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: If else call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228557#M41289</link>
      <description>&lt;P&gt;You need to expand the "plus" as else you're hiding the relevant parts of the log.&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/399iCCE1DD0B09B6E93A/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for the code you've posted: I can run it without errors as long as the files listed in "output_files.txt"&amp;nbsp;files exist.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 00:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-call-execute/m-p/228557#M41289</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-06T00:21:40Z</dc:date>
    </item>
  </channel>
</rss>

