<?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: getting the last modified file in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698626#M37535</link>
    <description>&lt;P&gt;If, OTOH, you want to extract&lt;/P&gt;
&lt;PRE&gt;pilote_2017_2021_validation_v004&lt;/PRE&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;PRE&gt;pilote_2017_2021_validation_v004.mdf.0.0.0.spds9&lt;/PRE&gt;
&lt;P&gt;then the SCAN method is valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples like this show how hard it can be to make a macro so flexible that it deals with all possible scenarios; in the end you end up doing more work on the macro than the discrete solutions would need.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Nov 2020 11:34:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-11-13T11:34:42Z</dc:date>
    <item>
      <title>getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698522#M37527</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to eliminate the file extension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro lastmodifiedfile2(path,string,MName);&lt;BR /&gt;&lt;BR /&gt;/** Change the filename below to the following to run on UNIX **/&lt;BR /&gt;/** filename test pipe "ls &amp;amp;path -rt"; **/&lt;/P&gt;
&lt;P&gt;/** Change the filename below to the following to run on Windows **/&lt;BR /&gt;/** filename test pipe "dir &amp;amp;path /od /t:w /b"; **/&lt;/P&gt;
&lt;P&gt;/*filename test pipe "ls &amp;amp;path -rt";*/ &lt;BR /&gt;/*filename test pipe "ls &amp;amp;path -rt|basename |grep &amp;amp;string.";*/&lt;BR /&gt;filename test pipe "ls &amp;amp;path -rt|grep &amp;amp;string. ";&lt;BR /&gt;&lt;BR /&gt;data _null_; &lt;BR /&gt;infile test; &lt;BR /&gt;input; &lt;BR /&gt;call symputx("&amp;amp;Mname.",_infile_,'g'); &lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;%put Last file to be modified in &amp;amp;path is: &amp;amp;Mname.; &lt;BR /&gt;&lt;BR /&gt;%mend lastmodifiedfile2;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;%lastmodifiedfile2(&amp;amp;soudest1.,&amp;amp;suffix1., FName1);&lt;/P&gt;
&lt;P&gt;%put &amp;amp;Fname1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;Fname1 is equal to&amp;nbsp;pilote_2017_2021_validation_v004.mdf.0.0.0.spds9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there an extra command I can add to get only&amp;nbsp;pilote_2017_2021_validation_v004&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 20:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698522#M37527</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-11-12T20:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698591#M37531</link>
      <description>&lt;P&gt;Have you tried SCAN function in the call symputx?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%macro lastmodifiedfile2(path,string,MName);

/** Change the filename below to the following to run on UNIX **/
/** filename test pipe "ls &amp;amp;path -rt"; **/

/** Change the filename below to the following to run on Windows **/
/** filename test pipe "dir &amp;amp;path /od /t:w /b"; **/

/*filename test pipe "ls &amp;amp;path -rt";*/
/*filename test pipe "ls &amp;amp;path -rt|basename |grep &amp;amp;string.";*/
filename test pipe "ls &amp;amp;path -rt|grep &amp;amp;string. ";

data _null_;
infile test;
input;
call symputx("&amp;amp;Mname.",scan(_infile_,1,'.'),'g');
run;

%put Last file to be modified in &amp;amp;path is: &amp;amp;Mname.;

%mend lastmodifiedfile2;


%lastmodifiedfile2(&amp;amp;soudest1.,&amp;amp;suffix1., FName1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Nov 2020 08:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698591#M37531</guid>
      <dc:creator>jarapoch</dc:creator>
      <dc:date>2020-11-13T08:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698616#M37534</link>
      <description>&lt;P&gt;I would rather use FINDC with "B", so I get the position of the last period; filenames might contain more than one period, and only the last is wanted to remove the extension.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx("&amp;amp;Mname.",substr(_infile_,1,findc(_infile_,".","b")-1),"g");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And to only get the first filename returned by the external command, STOP at the end of the data step, so that only one iteration is performed.&lt;/P&gt;
&lt;P&gt;Or add another command:&lt;/P&gt;
&lt;PRE&gt;ls &amp;amp;path -rt|grep &amp;amp;string. |head -1&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Nov 2020 10:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698616#M37534</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-13T10:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698626#M37535</link>
      <description>&lt;P&gt;If, OTOH, you want to extract&lt;/P&gt;
&lt;PRE&gt;pilote_2017_2021_validation_v004&lt;/PRE&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;PRE&gt;pilote_2017_2021_validation_v004.mdf.0.0.0.spds9&lt;/PRE&gt;
&lt;P&gt;then the SCAN method is valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples like this show how hard it can be to make a macro so flexible that it deals with all possible scenarios; in the end you end up doing more work on the macro than the discrete solutions would need.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 11:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698626#M37535</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-13T11:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698655#M37536</link>
      <description>Hello Mr. Kurt Bremser,&lt;BR /&gt;&lt;BR /&gt;I have communicate  with you in the past and I know that you are very strong in SAS as in Unix.  Could you please provide me a link where I can get a good PDF document to learn Unix.  &lt;BR /&gt;&lt;BR /&gt;Also, this command filename test pipe "ls &amp;amp;path -rt|grep &amp;amp;string. |head -1"; did not give me the expected result which should be  for example: pilote_2017_2021_scenario_v003</description>
      <pubDate>Fri, 13 Nov 2020 13:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698655#M37536</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-11-13T13:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: getting the last modified file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698684#M37538</link>
      <description>&lt;P&gt;ls -rt gives you the files in reverse order of the modification time. grep filters out those files containing the string in the name, and head -1 filters the first line.&lt;/P&gt;
&lt;P&gt;Adding l to the ls call (ls -lrt) displays (among other things) the modification time.&lt;/P&gt;
&lt;P&gt;So you could read the results of the simple ls -lrt into a dataset, and inspect that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Learning UNIX" is so broad that it dwarfs "learning Shakespeare", by orders of magnitude.&lt;/P&gt;
&lt;P&gt;Start with the basic utilities you will use:&lt;/P&gt;
&lt;P&gt;ls&lt;/P&gt;
&lt;P&gt;cd&lt;/P&gt;
&lt;P&gt;cp&lt;/P&gt;
&lt;P&gt;mv&lt;/P&gt;
&lt;P&gt;rm&lt;/P&gt;
&lt;P&gt;pwd&lt;/P&gt;
&lt;P&gt;more (or its more modern brother less)&lt;/P&gt;
&lt;P&gt;cat&lt;/P&gt;
&lt;P&gt;echo&lt;/P&gt;
&lt;P&gt;grep&lt;/P&gt;
&lt;P&gt;find&lt;/P&gt;
&lt;P&gt;head&lt;/P&gt;
&lt;P&gt;tail&lt;/P&gt;
&lt;P&gt;kill&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, make yourself familar with the most widely used shell, bash, and how to write scripts in it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doing a google search for "&lt;EM&gt;command&lt;/EM&gt; manual" will quickly lead you to resources for the &lt;EM&gt;command&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good starting point will also be the the manufacturer's website, like &lt;A href="https://www.ibm.com/support/knowledgecenter/ssw_aix_72/navigation/commands.html" target="_blank" rel="noopener"&gt;this&lt;/A&gt; for IBM's AIX.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 15:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/getting-the-last-modified-file/m-p/698684#M37538</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-13T15:20:34Z</dc:date>
    </item>
  </channel>
</rss>

