<?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: Convert macro variable date to yymmddn8 to use in file path in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488847#M127474</link>
    <description>&lt;P&gt;Anytime, glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Aug 2018 12:43:48 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-08-22T12:43:48Z</dc:date>
    <item>
      <title>Convert macro variable date to yymmddn8 to use in file path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488811#M127450</link>
      <description>&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Hi I have this peace of code which i want to use to look up a file created 6 days ago, e.g. 20180816. The file name should be G20180816.txt. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; kurs_datum = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(today())-6); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; format_date;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; kurs_datum &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; infil="C:\G&amp;amp;kurs_datum..txt";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;When i run this code i got this error message. It looks like that it is still using SAS's date format.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Physical file does not exist, C:\G21412.txt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I solve this?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 10:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488811#M127450</guid>
      <dc:creator>irisG</dc:creator>
      <dc:date>2018-08-22T10:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert macro variable date to yymmddn8 to use in file path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488813#M127452</link>
      <description>&lt;P&gt;handle date calculations in the data step and use CALL SYMPUT logic to create macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   dt=today()-6;
   path=cats("'C:\G", put(dt, yymmddn8.), ".txt'");
   call symputx('path', path);
run;

%put &amp;amp;path.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 10:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488813#M127452</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-22T10:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert macro variable date to yymmddn8 to use in file path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488818#M127457</link>
      <description>Works like a charm! Many thanks!</description>
      <pubDate>Wed, 22 Aug 2018 10:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488818#M127457</guid>
      <dc:creator>irisG</dc:creator>
      <dc:date>2018-08-22T10:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert macro variable date to yymmddn8 to use in file path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488847#M127474</link>
      <description>&lt;P&gt;Anytime, glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 12:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-macro-variable-date-to-yymmddn8-to-use-in-file-path/m-p/488847#M127474</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-22T12:43:48Z</dc:date>
    </item>
  </channel>
</rss>

