I've another question. How will you pass values to the maco paramter 'filename'? I need to pass values from the other macro (filelist) to the macro parameter 'filename' instead of explicitly defining the values. I did tried like below,
In the code below,filename resolves to SASApp_STPServer_2015-10-01_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 search both the file at the same moment and it failed as it could not find both the file in a single data step.
Could
proc sql noprint;
select distinct fname into :filelist separated by ' '
from log.output_file;
quit;
%put &filelist;
%macro log_analysis
(filename =&filelist /* Physical name of input file */
,data=work.log_analysis /* Name of SAS dataset */
,base=log.log_analysis /* Name of the Master dataset */
);
data &data;
set log.output_file;
length fname $400;
infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/&filename" dsd truncover END = end_of_file LRECL=32000;
fname="&filename" ;
DO WHILE (not end_of_file);
input var : $ 3000.;
var1 = _infile_;
if var1 = :'201' then do;
...........
...........
output;
end;
end;
run;
proc append data=&data base=&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;
you 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
Log:
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.
Thanks for any help you offer me.
... View more