<?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: Creating Macro Variable from a .txt file name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521124#M141380</link>
    <description>&lt;P&gt;Thank You! I will give this a try and post the code if it works.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Dec 2018 12:54:32 GMT</pubDate>
    <dc:creator>nds5134</dc:creator>
    <dc:date>2018-12-13T12:54:32Z</dc:date>
    <item>
      <title>Creating Macro Variable from a .txt file name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521026#M141333</link>
      <description>&lt;P&gt;I am trying to take a semi-automated code to become fully automated. Currently we have .txt files dropped daily in a folder with the naming convention FILE1_DS1_20181212_20181212.txt, sometimes this last part of the name is a range such as FILE2_DS1_20181210_20181212.txt.&amp;nbsp; Currently, every morning when I run the code I change the macro variables to match the correct dates which are needed (i.e %LET FILEDTE1=20181210, %LET FILEDTE2=20181212) so the files read in correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for SAS to automatically pull those date values from the .txt file name? The date variables are later used in imports and outputs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI for more information we have 100+ text files that have this naming convention which are processed daily. I'm trying to account for data drops that cover the weekend, and other reasons,such as holidays, that may cause a date range.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 22:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521026#M141333</guid>
      <dc:creator>nds5134</dc:creator>
      <dc:date>2018-12-12T22:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Macro Variable from a .txt file name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521028#M141334</link>
      <description>I'll describe the process. &lt;BR /&gt;1. Write a small program that scans a folder and pulls all filenames&lt;BR /&gt;2. Filter filenames for ones relevant to you&lt;BR /&gt;3. Determine which files need to be read&lt;BR /&gt;4. Read&lt;BR /&gt;5. Repeat&lt;BR /&gt;&lt;BR /&gt;All of these steps have been asked and answered on here, and some are actually in the SAS macro appendix. &lt;BR /&gt;&lt;BR /&gt;Good Luck!</description>
      <pubDate>Wed, 12 Dec 2018 22:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521028#M141334</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-12T22:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Macro Variable from a .txt file name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521124#M141380</link>
      <description>&lt;P&gt;Thank You! I will give this a try and post the code if it works.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 12:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Macro-Variable-from-a-txt-file-name/m-p/521124#M141380</guid>
      <dc:creator>nds5134</dc:creator>
      <dc:date>2018-12-13T12:54:32Z</dc:date>
    </item>
  </channel>
</rss>

