<?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: Error while Reading multiple files with filevar statement - Invalid physical name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227387#M40965</link>
    <description>&lt;P&gt;When I recreate the .txt file, error did not appears.&lt;/P&gt;</description>
    <pubDate>Sat, 26 Sep 2015 11:17:52 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2015-09-26T11:17:52Z</dc:date>
    <item>
      <title>Error while Reading multiple files with filevar statement - Invalid physical name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227381#M40960</link>
      <description>&lt;P&gt;I'm trying to read the series of files from .txt file via SAS macros. However I could not succeed for unknown reason. I'm puzzled where to resolve this error. Could someone check that my infile statement is do loops are having any issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Your help is greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code looks like,&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 log_analysis;
%let filedate=%sysfunc(putn("&amp;amp;sysdate9"d-1,yymmdd10.));
%put &amp;amp;filedate;
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," ");
Status = scan(var1,2," ");
Processid = scan(var1,3," ");
userid = scan(var1,4," ");
Details = scan(var1,-1,'-');
output;
end;
end;
drop var var1;
run;
%mend log_analysis;

data _null_;
  set log.output_file;
  if fname =: '/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First datastep to create a dataset log.output_file&amp;nbsp;was succeed and it has 3 observations as 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-09-25_tmptcmsaslva2_19142.log&lt;BR /&gt;/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-25_tmptcmsaslva2_18208.log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run my code I got error as follows,&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 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.;    var1 = _infile_;  if var1 = :'201' then 
do;
2         +  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;

NOTE: The variable fname exists on an input data set, but was also specified in an I/O statement option.  The variable will not be 
      included on any output data set.
NOTE: The infile DUMMY is:
      Filename=/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-25_tmptcmsaslva2_19142.log,
      Owner Name=sassrv,Group Name=sas,
      Access Permission=rwxrwxr-x,
      Last Modified=Sat Sep 26 00:00:33 2015,
      File Size (bytes)=8555812

NOTE: The infile DUMMY is:
      Filename=/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-25_tmptcmsaslva2_18208.log,
      Owner Name=sassrv,Group Name=sas,
      Access Permission=rwxrwxr-x,
      Last Modified=Sat Sep 26 02:10:34 2015,
      File Size (bytes)=1831

ERROR: Invalid physical name.
fname=  filename=  end_of_file=1 var=  var1=  Date_TimeStamp=  Status=  Processid=  userid=  Details=  _ERROR_=1 _INFILE_=  _N_=3
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements. This might cause NOTE: No observations in data set.
NOTE: There were 3 observations read from the data set LOG.OUTPUT_FILE.
WARNING: The data set LOG.LOG_ANALYSIS may be incomplete.  When this step was stopped there were 67962 observations and 6 variables.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2015 09:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227381#M40960</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-09-26T09:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error while Reading multiple files with filevar statement - Invalid physical name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227386#M40964</link>
      <description>&lt;P&gt;The 3rd observation in log.output_file is empty (fname='') ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;data log.output_file ;&lt;/P&gt;&lt;P&gt;infile "&amp;amp;path/output_file.txt" firstobs=2 truncover lrecl=400;&lt;/P&gt;&lt;P&gt;input fname $400.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if fname ne '';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2015 10:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227386#M40964</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-09-26T10:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error while Reading multiple files with filevar statement - Invalid physical name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227387#M40965</link>
      <description>&lt;P&gt;When I recreate the .txt file, error did not appears.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2015 11:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227387#M40965</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-09-26T11:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error while Reading multiple files with filevar statement - Invalid physical name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227415#M40977</link>
      <description>&lt;P&gt;There you go!&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2015 05:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-Reading-multiple-files-with-filevar-statement/m-p/227415#M40977</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-09-27T05:51:32Z</dc:date>
    </item>
  </channel>
</rss>

