<?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: Create a 'DO' loop to run macro Based on the Folder names present a Folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842194#M333015</link>
    <description>&lt;P&gt;Thank you Tom. It kind worked.&amp;nbsp; I used the concept from your code. However got a question FIPstate creates the list of states. What's situation if the folder names are different?&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 19:40:47 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2022-11-02T19:40:47Z</dc:date>
    <item>
      <title>Create a 'DO' loop to run macro Based on the Folder names present a Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842111#M332982</link>
      <description>&lt;P&gt;I am trying to compare the data present in the folder ( which check for latest data). I am running the macro to do this but I believe, I am&amp;nbsp; not doing the efficient way. I have the folder structure like mentioned in the image ( Tried approximately to match my expectation). So I am expecting to check what States ( Folder names) present in the 'Expens-2022' and create a macro variables and compare that with the same state folders present in the 'Doc ' Folder instead checking the&amp;nbsp; Expens-2022' folder and entering each state name while calling the macro. I do have the macro '%expense which do the job. But how to achieve this instead. I am trying to control the State macro variable ( if it makes any sense.) Thanks for your input..&amp;nbsp; Thank you for your input.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%expnse(state= , prv= );
--------
----------
-----------
%mend;

%expense(state= NJ,  prv= DOC);
%expense(state= MA,  prv= DOC);
%expense(state= NY,  prv= DOC);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1667401131664.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76870iC4AC89C743698C58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1667401131664.png" alt="SASuserlot_0-1667401131664.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842111#M332982</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-02T15:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a 'DO' loop to run macro Based on the Folder names present a Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842118#M332986</link>
      <description>&lt;P&gt;Do you have list of the states?&amp;nbsp; If not then perhaps you can use the FIPSTATE() function to generate the list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do fip=1 to 56 ;
    state = fipstate(fip);
    if state ne '--' then do;
      call execute(cats('%nrstr(%expense)(state=',state,',prv=DOC)'));
    end ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842118#M332986</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-02T15:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a 'DO' loop to run macro Based on the Folder names present a Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842129#M332987</link>
      <description>I once wrote a SAS program that would shell out to the operating system, run an operating system directory listing to create a list of subdirectories in a folder (for example, in Windows:)&lt;BR /&gt;prompt:&amp;gt; cd C:\path\to\directory&lt;BR /&gt;prompt:&amp;gt; DIR *. &lt;BR /&gt;I may have redirected the output to a text file or somehow dumped the output (subdirectory names) into a SAS table, and then I just wrote a macro to iterate through the table of available directories.  Looking for that code now but it might be gone.</description>
      <pubDate>Wed, 02 Nov 2022 16:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842129#M332987</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2022-11-02T16:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create a 'DO' loop to run macro Based on the Folder names present a Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842194#M333015</link>
      <description>&lt;P&gt;Thank you Tom. It kind worked.&amp;nbsp; I used the concept from your code. However got a question FIPstate creates the list of states. What's situation if the folder names are different?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 19:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842194#M333015</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-02T19:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a 'DO' loop to run macro Based on the Folder names present a Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842213#M333027</link>
      <description>&lt;P&gt;There are lots of ways to ask the operating system what files and directories exist.&lt;/P&gt;
&lt;P&gt;Here is one that will span a whole sub-tree of the directory and collect all of the folders.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/dirtree.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/dirtree.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 21:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-DO-loop-to-run-macro-Based-on-the-Folder-names-present/m-p/842213#M333027</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-02T21:14:38Z</dc:date>
    </item>
  </channel>
</rss>

