<?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: iterate multiple files and perform a certain condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818590#M323113</link>
    <description>&lt;P&gt;What are you trying to do?&lt;/P&gt;
&lt;P&gt;If you want to run the macro&amp;nbsp;ImportData_BABC for every file listed in&amp;nbsp;input_file then why not just do that directly?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set input_file;
  call execute(cats('%nrstr(%importdata_babc)(',file_name,',results_in)'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are trying to do something else then explain what that is.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 15:04:07 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-16T15:04:07Z</dc:date>
    <item>
      <title>iterate multiple files and perform a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818586#M323112</link>
      <description>&lt;P&gt;Hi is there another way in doing the below. I have displayed input_file below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Import_File(records);
	%if  &amp;amp;records. &amp;gt; 0 %then
		%do;
			/* %do i=1 %to &amp;amp;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(&amp;amp;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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;this is how the input_file looks.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dennis_oz_0-1655390546448.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72369i6FD3B2D63B786CA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dennis_oz_0-1655390546448.png" alt="dennis_oz_0-1655390546448.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 14:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818586#M323112</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2022-06-16T14:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: iterate multiple files and perform a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818590#M323113</link>
      <description>&lt;P&gt;What are you trying to do?&lt;/P&gt;
&lt;P&gt;If you want to run the macro&amp;nbsp;ImportData_BABC for every file listed in&amp;nbsp;input_file then why not just do that directly?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set input_file;
  call execute(cats('%nrstr(%importdata_babc)(',file_name,',results_in)'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are trying to do something else then explain what that is.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 15:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818590#M323113</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-16T15:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: iterate multiple files and perform a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818591#M323114</link>
      <description>Like baby, I will have other file names like welcome,  leaving etc...&lt;BR /&gt;&lt;BR /&gt;How will I handle this? I hope I am clear with my requirement&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jun 2022 15:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818591#M323114</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2022-06-16T15:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: iterate multiple files and perform a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818595#M323115</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps something like this?:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where file_name =: 'BABC_Export' ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where index(file_name,'.') and lowcase(scan(file_name,-1,'.'))='csv' ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jun 2022 15:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterate-multiple-files-and-perform-a-certain-condition/m-p/818595#M323115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-16T15:16:22Z</dc:date>
    </item>
  </channel>
</rss>

