<?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: infile last file of the month (based on date) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400935#M97205</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107827"&gt;@Jedrzej&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Assuming you don't expect us to provide the full code free of charge: What's the question/problem you need help with? What have you done already?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case you don't know how to align a date to the end of month: Look up the intnx() function in the docu.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2017 12:50:07 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-10-04T12:50:07Z</dc:date>
    <item>
      <title>infile last file of the month (based on date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400931#M97202</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to write a macro that will infile my txt (name of the file is based in a date, example:&amp;nbsp; aaa_20170929)&amp;nbsp;file on the last working day of the month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, last working day of september was 29, last day of october is 31.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 12:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400931#M97202</guid>
      <dc:creator>Jedrzej</dc:creator>
      <dc:date>2017-10-04T12:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: infile last file of the month (based on date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400935#M97205</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107827"&gt;@Jedrzej&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Assuming you don't expect us to provide the full code free of charge: What's the question/problem you need help with? What have you done already?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case you don't know how to align a date to the end of month: Look up the intnx() function in the docu.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 12:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400935#M97205</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-04T12:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: infile last file of the month (based on date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400941#M97207</link>
      <description>i'm getting txt files from monday to friday. I want to infile just the last file that exist of the previous month, every first day of the current month.&lt;BR /&gt;&lt;BR /&gt;So the problem is that the names of files are based on the date that they were generated and if the last day of the month will be Sunday there won't be any file.&lt;BR /&gt;&lt;BR /&gt;I need a macro that will check txt files from the previous month and infile the last one that exist.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Oct 2017 13:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400941#M97207</guid>
      <dc:creator>Jedrzej</dc:creator>
      <dc:date>2017-10-04T13:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: infile last file of the month (based on date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400943#M97208</link>
      <description>&lt;P&gt;So, step one get date value, second step use to import, rough guess:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  prev=intnx('',today(),-1,'end'); /* Moves back a month */
  if weekday(prev)=1 then prev=prev-2;  /* sunday so remove 2 */
  if weekday(prev)=7 then prev=prev-1;  /* sat so -1 */
  call symputx('dt',put(prev,yymmdd10.));
run;

data want;
  infile "c:\abc_&amp;amp;dt..txt";
...
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Oct 2017 13:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/400943#M97208</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-04T13:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: infile last file of the month (based on date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/401209#M97318</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year=2017;
%let month=9;

%let want=%sysfunc(intnx(weekday,%sysfunc(mdy(&amp;amp;month+1,1,&amp;amp;year))-1,0),yymmddn.);

%put &amp;amp;want;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Oct 2017 07:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-last-file-of-the-month-based-on-date/m-p/401209#M97318</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-05T07:30:59Z</dc:date>
    </item>
  </channel>
</rss>

