<?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: Macro parameters for file names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228390#M41257</link>
    <description>&lt;P&gt;Babloo go back to the design of the process. The reason:&lt;/P&gt;&lt;P&gt;- You cannot specify external filenames in the same way als doing that wiht tables/datsets.&lt;/P&gt;&lt;P&gt;- The translation to the physical has to be doen at some moment&lt;/P&gt;&lt;P&gt;This leaves you to the choice of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;a/ &amp;nbsp;processing all files in a location using: &amp;nbsp; FILENAME=&lt;SPAN class="xis-userSuppliedValue"&gt;variable&amp;nbsp; &lt;/SPAN&gt;specifies a variable that SAS sets to the physical name of the currently opened input file.&amp;nbsp;&amp;nbsp;The wildcards or perl-regular string like&amp;nbsp;should make&amp;nbsp;that easy (dates!).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#p1cycu6ky2lsd7n0zqaskousxy5y.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#p1cycu6ky2lsd7n0zqaskousxy5y.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;b/ Define a list of files in a data-set table and process those&amp;nbsp;using: FILEVAR=&lt;SPAN class="xis-userSuppliedValue"&gt;variable&amp;nbsp; &lt;/SPAN&gt;specifies a variable whose change in value causes the INFILE statement to close the current input file and open a new one.&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you see your log the specifyng off several names is done like a single&amp;nbsp;name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could define a list (concatenation) that way. &lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#n066409vu4xdwfn17tf89hhlb5xh.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#n066409vu4xdwfn17tf89hhlb5xh.htm&lt;/A&gt; it s more handy for code versioning wiht releasemanagement as for processsing data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2015 09:09:31 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2015-10-05T09:09:31Z</dc:date>
    <item>
      <title>Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228384#M41254</link>
      <description>&lt;P&gt;I've to pass file names as macrometer and have to append the datasets once all the files are read.However, I'm experiencing the issue when filenames is greater than 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In&amp;nbsp;the code below,filename resolves to SASApp_STPServer_2015-10-01_tmptcmsaslva2_18208.log and SASApp_STPServer_2015-10-04_tmptcmsaslva2_19142.log. These two .log files are different file and I was expecting SAS to process the file one-by-one and then need to consolidate to one master dataset log.log_analysis. When I ran the code below, SAS was trying to&amp;nbsp;search both the file at the same moment and it failed as it could not find both the file in a single data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone guide me how to achive this task? Please be informed that the macro filelist is also resolves to SASApp_STPServer_2015-10-01_tmptcmsaslva2_18208.log and SASApp_STPServer_2015-10-04_tmptcmsaslva2_19142.log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select distinct fname into :filelist separated by ' '
from log.output_file;
quit;

%put &amp;amp;filelist;


%macro log_analysis
(filename =&amp;amp;filelist  /* Physical name of input file */
,data=work.log_analysis /* Name of SAS dataset */
,base=log.log_analysis /* Name of the Master dataset */
);

data &amp;amp;data;
set log.output_file;
length fname $400;
infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/&amp;amp;filename" dsd truncover  END = end_of_file LRECL=32000;
fname="&amp;amp;filename" ;
DO WHILE (not end_of_file);
input var : $ 3000.;
var1 = _infile_;
if var1 = :'201' then do;
...........
...........
output;
end;
end;
run;

proc append data=&amp;amp;data base=&amp;amp;base force;
run;

%mend log_analysis;

data _null_;
  set log.output_file;
  if fname =: 'SASApp_STPServer' then call execute ('%log_analysis;');
else put 'no log files';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log snippet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: CALL EXECUTE generated line.
1         + data work.log_analysis;  set log.output_file;    length fname $400;  infile 
"/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-10-01_18208.log 
SASApp_STPServer_2015-10-04_19142.log" dsd truncover
2         + END = end_of_file LRECL=32000;  fname="SASApp_STPServer_2015-10-01_tmptcmsaslva2_18208.log 
SASApp_STPServer_2015-10-04_19142.log" ;  DO WHILE (not end_of_file);  input var : $ 3000.;    var1 = _infile_;  if 
var1 = :'201' then do;
3         + Date_TimeStamp= scan(var1,1," ");  Status = scan(var1,2," ");  Processid = scan(var1,3," ");  userid = scan(var1,4," 
");  Details = scan(var1,-1,'-');  output;  end;  end;  drop var var1;  run;

ERROR: Physical file does not exist, 
       /usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-10-01_18208.log 
       SASApp_STPServer_2015-10-04_19142.log.
NOTE: The SAS System stopped processing this step because of errors.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Oct 2015 07:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228384#M41254</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T07:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228387#M41255</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are mixing things up again.&lt;/P&gt;
&lt;PRE&gt;%macro log_analysis (filename=,data=,base=);
  data &amp;amp;DATA.;
    length fname $400;
    infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/&amp;amp;FILENAME." dsd truncover end=end_of_file lrecl=32000;
    input x $ y $;
  run;
  proc append data=&amp;amp;DATA. base=&amp;amp;BASE. force;
  run;
%mend log_analysis;

data _null_;
  set log.output_file;
  call execute (cats('%log_analysis(filename=',fname,',data=',fname,',base=base'));
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lets look at the above code. &amp;nbsp;First we define a macro. &amp;nbsp;This is code that will be executed once per call. &amp;nbsp;It accepts a fname, reads that file into a dataset, then appends it to a base dataset. &amp;nbsp;Now we need to call this macro for a list of file names. &amp;nbsp;Assuming you have a list of these in log.output_file, we can use the base characteristic of a dataset (which is a loop) to create the calls to the macro. &amp;nbsp;You do not need to check if there any, because if there are 0 records in that dataset the call execute never gets called.&lt;/P&gt;
&lt;P&gt;What you don't want to be doing is passing a large amount of data (filenames) via macro paramters. &amp;nbsp;Firstly there are limits on what macro parameters can hold, secondly the code for this just gets needlessly messy and complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mentioned several times on these posts, write your code in Base SAS first for one element. &amp;nbsp;In the above case this would be the datastep with no macro parameters. &amp;nbsp;Once that is there and it works, then identify which parts of the code would need to change each run. &amp;nbsp;These become your parameters. &amp;nbsp;Then you need to decide how the call will be made, in this instance we have a datastep we will use as a loop. &amp;nbsp;Remember, SAS Macro is not a real programming language, it is a text generator. &amp;nbsp;Base is the programming language, macro is there to assist in not typing things out many times, so work out the Base code needed, then wrap it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to add, consistent indetation, code formatting etc. makes code far easier to read.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 08:44:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228387#M41255</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-05T08:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228390#M41257</link>
      <description>&lt;P&gt;Babloo go back to the design of the process. The reason:&lt;/P&gt;&lt;P&gt;- You cannot specify external filenames in the same way als doing that wiht tables/datsets.&lt;/P&gt;&lt;P&gt;- The translation to the physical has to be doen at some moment&lt;/P&gt;&lt;P&gt;This leaves you to the choice of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;a/ &amp;nbsp;processing all files in a location using: &amp;nbsp; FILENAME=&lt;SPAN class="xis-userSuppliedValue"&gt;variable&amp;nbsp; &lt;/SPAN&gt;specifies a variable that SAS sets to the physical name of the currently opened input file.&amp;nbsp;&amp;nbsp;The wildcards or perl-regular string like&amp;nbsp;should make&amp;nbsp;that easy (dates!).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#p1cycu6ky2lsd7n0zqaskousxy5y.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#p1cycu6ky2lsd7n0zqaskousxy5y.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;b/ Define a list of files in a data-set table and process those&amp;nbsp;using: FILEVAR=&lt;SPAN class="xis-userSuppliedValue"&gt;variable&amp;nbsp; &lt;/SPAN&gt;specifies a variable whose change in value causes the INFILE statement to close the current input file and open a new one.&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you see your log the specifyng off several names is done like a single&amp;nbsp;name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could define a list (concatenation) that way. &lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#n066409vu4xdwfn17tf89hhlb5xh.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#n066409vu4xdwfn17tf89hhlb5xh.htm&lt;/A&gt; it s more handy for code versioning wiht releasemanagement as for processsing data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 09:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228390#M41257</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-10-05T09:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228392#M41258</link>
      <description>&lt;P&gt;I got the following error as follows after I modified my original code as per your suggetsion. There is only one file name in '&lt;SPAN&gt;log.output_file'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;53         data _null_;
54           set log.output_file;
55           call execute (cats('%log_analysis(filename=',fname,',data=',fname,',base=base'));
56         run;

56       !     
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
MLOGIC(LOG_ANALYSIS):  Beginning execution.
ERROR: Macro parameter contains syntax error.
MLOGIC(LOG_ANALYSIS):  Ending execution.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set LOG.OUTPUT_FILE.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm not familar with call execute syntax and it is little confusing to me. May I request you to guide me to come past this error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro log_analysis
(filename =  /* Physical name of input file */
,data= /* Name of SAS dataset */
,base= /* Name of the Master dataset */
);

%let filedate=%sysfunc(putn("&amp;amp;sysdate9"d-1,yymmdd10.));
%put &amp;amp;filedate;

data &amp;amp;data;
set log.output_file;
length fname $400;
infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/&amp;amp;filename" dsd truncover  END = end_of_file LRECL=32000;
fname="&amp;amp;filename" ;
/*DO WHILE (not end_of_file);*/
input var : $ 3000.;
var1 = _infile_;
if var1 = :'201' then do;
Date_TimeStamp= scan(var1,1," ");
Status = scan(var1,2," ");
Processid = scan(var1,3," ");
userid = scan(var1,4," ");
Details = scan(var1,-1,'-');
output;
end;&lt;BR /&gt;/*end;*/
drop var var1;
run;

proc append data=&amp;amp;data base=&amp;amp;base force;
run;

%mend log_analysis;

data _null_;
  set log.output_file;
  call execute (cats('%log_analysis(filename=',fname,',data=',fname,',base=base'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once this code runs for one file, can I uncomment the 'do while' loop and 'end' in the datastep to run for multiple files and create a master (base) dataset?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 09:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228392#M41258</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T09:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228406#M41265</link>
      <description>&lt;P&gt;Noticing your are trying to analyse a file that has been created from the ARM logging framework to create a table format.&lt;/P&gt;&lt;P&gt;Did you realize the same logging framework can be configured to write all data in a RDBMS (SAS/Share) dataset?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 12:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228406#M41265</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-10-05T12:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228412#M41268</link>
      <description>&lt;P&gt;If I've one file, program is running perfectly. It is failing, If I've morethan one file as I told in my previous post.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 13:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228412#M41268</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T13:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228448#M41272</link>
      <description>&lt;P&gt;Go back to your code without macros that works for one file.&lt;/P&gt;
&lt;P&gt;Put both files in the place you have one file.&lt;/P&gt;
&lt;P&gt;You likely will get the same errors.&lt;/P&gt;
&lt;P&gt;That is what your macro is doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to provide the code to identify how many files are passed and then to process each of them separately.&lt;/P&gt;
&lt;P&gt;Search the forum, there are multiple examples in different flavors of this.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 15:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228448#M41272</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-10-05T15:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228476#M41275</link>
      <description>May I request you to route me to any of those examples? I've trouble finding those threads.&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Mon, 05 Oct 2015 17:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228476#M41275</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-05T17:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228564#M41292</link>
      <description>I'm seeking for someone's guidance.</description>
      <pubDate>Tue, 06 Oct 2015 01:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228564#M41292</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-10-06T01:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228571#M41293</link>
      <description>&lt;P&gt;Why are there multiple threads from you with basically the same topic and none of these threads has been closed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That makes things very messy and I don't feel like reading through all these extensive but similar threads to work out which answers you've already got and what could still be missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe you need to "re-start"&amp;nbsp;and first make things work without macro coding. A starting point could be:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only "macrotize" your solution once the base SAS stuff works.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 05:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228571#M41293</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-06T05:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameters for file names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228790#M41355</link>
      <description>&lt;P&gt;Babloo, he must fundamental one.&amp;nbsp;The admin con configure to store SP logging files content.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How&amp;nbsp;the data for ARM can be stored directly to a tabel (exteren dbms / sas-share) is described in this nice blog post&amp;nbsp;at: &lt;A href="http://blogs.sas.com/content/sgf/2015/09/30/part-1-auditing-data-access-who-did-what-and-when/" target="_blank"&gt;http://blogs.sas.com/content/sgf/2015/09/30/part-1-auditing-data-access-who-did-what-and-when/&lt;/A&gt;&lt;BR /&gt;There is no need to develop something for functionality that can be configured.&lt;BR /&gt;&lt;BR /&gt;There is no need to use macro-processing only some fixed/moving values.&lt;/P&gt;&lt;P&gt;The PID number is part of filename as setup in the mentioned config-files. As it is a randomnumber&amp;nbsp;it shoudl be masked/wild-carded.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let filedate=%sysfunc(putn("&amp;amp;sysdate9"d-1,yymmdd10.));&lt;BR /&gt;%put &amp;amp;filedate; /* this date lay-out can be put in the source later */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data &amp;amp;data;&lt;BR /&gt;set log.output_file;&lt;BR /&gt;length fname $400;&lt;BR /&gt;infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServ?er/Logs/SASApp_STPServer_2015-10-04_*.log"&lt;BR /&gt;&amp;nbsp; dsd truncover&amp;nbsp; END = end_of_file LRECL=32000 filename=fname ;&lt;BR /&gt;input var : $ 3000.;&lt;BR /&gt;var1 = _infile_;&lt;BR /&gt;if var1 = :'201' then do;&lt;BR /&gt;Date_TimeStamp= scan(var1,1," ");&lt;BR /&gt;Status = scan(var1,2," ");&lt;BR /&gt;Processid = scan(var1,3," ");&lt;BR /&gt;userid = scan(var1,4," ");&lt;BR /&gt;Details = scan(var1,-1,'-');&lt;BR /&gt;output;&lt;BR /&gt;end;drop var var1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;It will read all log files on that fixed date putting that in a dataset witt the fname having the switch for all read physical files.&lt;BR /&gt;Why overcomplicating that simple approach?&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reread the infile statement for the filename option.&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 09:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameters-for-file-names/m-p/228790#M41355</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-10-07T09:10:13Z</dc:date>
    </item>
  </channel>
</rss>

