Hi is there another way in doing the below. I have displayed input_file below
%macro Import_File(records);
%if &records. > 0 %then
%do;
/* %do i=1 %to &records.; */
%put 'enterd loop 1';
data _null_;
set input_file;
call symput ('file_name',strip(file_name));
select (actual_file_name);
when ('BABC_EXPORT') rc=dosubl('%ImportData_BABC(&file_name,results_in)');
otherwise;
STOP;
end;
%put 'exited loop 1';
run;
%end;
%else
%do;
%put 'loop 6';
/* data _null_;*/
/* rc=dosubl('%folder_empty_message()');*/
/* run;*/
%put 'exited loop 6 ';
%end;
%mend;
this is how the input_file looks.
What are you trying to do?
If you want to run the macro ImportData_BABC for every file listed in input_file then why not just do that directly?
data _null_;
set input_file;
call execute(cats('%nrstr(%importdata_babc)(',file_name,',results_in)'));
run;
If you are trying to do something else then explain what that is.
Add a WHERE statement (or a subsetting IF statement) to eliminate those observations before they can make it to the line that generates to macro call.
Perhaps something like this?:
where file_name =: 'BABC_Export' ;
Or perhaps
where index(file_name,'.') and lowcase(scan(file_name,-1,'.'))='csv' ;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: