<?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: Import a file from 2 days ago on Mondays but a file from current day Tue-Fri in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-a-file-from-2-days-ago-on-Mondays-but-a-file-from-current/m-p/439397#M282414</link>
    <description>&lt;P&gt;This might not cover everything, but it's the right place to start.&amp;nbsp; This statement doesn't do what you expect:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let date= weekday(today());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it runs without error, it assigns &amp;amp;DATE a 16-character value (the exact characters you see to the right of the equal sign, with no functions being executed).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you did in several earlier cases, you need to apply %SYSFUNC to get macro language to carry out DATA step functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let date = %sysfunc(weekday&lt;FONT color="#ff0000"&gt;(&lt;/FONT&gt;%sysfunc&lt;FONT color="#339966"&gt;(&lt;/FONT&gt;today()&lt;FONT color="#339966"&gt;)&lt;FONT color="#ff0000"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 18:35:12 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-02-22T18:35:12Z</dc:date>
    <item>
      <title>Import a file from 2 days ago on Mondays but a file from current day Tue-Fri</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-file-from-2-days-ago-on-Mondays-but-a-file-from-current/m-p/439371#M282413</link>
      <description>&lt;P&gt;I am trying to import 1 file name on Mondays and another file name on Tue-Fridays.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, on Monday I want to import the file from Saturday but on Tue-Fri I want to import the file for the current day.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is what I am trying.&amp;nbsp; It doesn't&amp;nbsp; seem to read the &amp;amp;today macro at all.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let today=%sysfunc(putn(%sysfunc(date()),yymmddn8.));&lt;BR /&gt;%let today2=%sysfunc(PUTN(%eval(%sysfunc(date()) - 2), yymmddn8.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro setdate(date);&lt;BR /&gt;%let date= weekday(today());&lt;BR /&gt;%if &amp;amp;date = 2 %then&lt;BR /&gt;%do;&lt;BR /&gt;proc import&amp;nbsp;out=M_IMPORT&amp;nbsp;&lt;/P&gt;&lt;P&gt;datafile="&amp;lt;path&amp;gt;/test/M_Daily_Admissions_&amp;amp;today2..csv"&lt;/P&gt;&lt;P&gt;dbms=csv replace;&lt;BR /&gt;datarow=2;&lt;BR /&gt;getnames=no;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%else %if &amp;amp;date &amp;lt;&amp;gt; 2 %then&lt;BR /&gt;%do;&lt;BR /&gt;proc import&amp;nbsp;out=M_IMPORT&amp;nbsp;&lt;/P&gt;&lt;P&gt;datafile="/&amp;lt;path&amp;gt;/test/M_Daily_Admissions_&amp;amp;today..csv"&lt;/P&gt;&lt;P&gt;dbms=csv replace;&lt;BR /&gt;datarow=2;&lt;BR /&gt;getnames=no;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend setdate;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 17:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-file-from-2-days-ago-on-Mondays-but-a-file-from-current/m-p/439371#M282413</guid>
      <dc:creator>khamsies</dc:creator>
      <dc:date>2018-02-22T17:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import a file from 2 days ago on Mondays but a file from current day Tue-Fri</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-file-from-2-days-ago-on-Mondays-but-a-file-from-current/m-p/439397#M282414</link>
      <description>&lt;P&gt;This might not cover everything, but it's the right place to start.&amp;nbsp; This statement doesn't do what you expect:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let date= weekday(today());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it runs without error, it assigns &amp;amp;DATE a 16-character value (the exact characters you see to the right of the equal sign, with no functions being executed).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you did in several earlier cases, you need to apply %SYSFUNC to get macro language to carry out DATA step functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let date = %sysfunc(weekday&lt;FONT color="#ff0000"&gt;(&lt;/FONT&gt;%sysfunc&lt;FONT color="#339966"&gt;(&lt;/FONT&gt;today()&lt;FONT color="#339966"&gt;)&lt;FONT color="#ff0000"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 18:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-file-from-2-days-ago-on-Mondays-but-a-file-from-current/m-p/439397#M282414</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-22T18:35:12Z</dc:date>
    </item>
  </channel>
</rss>

