<?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: how to read latest csv file  from a directory present in unix using sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779079#M248096</link>
    <description>&lt;P&gt;You could further simplify the retrieval of the filename:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile "ls -t /folder/subfolder/*.csv" pipe truncover ;
input filename $200.;
call symputx('fname',filename);
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro variable should have the complete path in it, so you don't need to explicitly code it in the next data step.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Nov 2021 09:04:29 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-11-08T09:04:29Z</dc:date>
    <item>
      <title>how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/778984#M248040</link>
      <description>&lt;P&gt;how to read latest csv file from a directory present in unix using sas code&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 13:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/778984#M248040</guid>
      <dc:creator>Sandhya55</dc:creator>
      <dc:date>2021-11-07T13:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/778987#M248043</link>
      <description>&lt;P&gt;I think this might be the answer&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Reading-filenames-date-and-time-from-a-directory/m-p/452297" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Reading-filenames-date-and-time-from-a-directory/m-p/452297&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 14:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/778987#M248043</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-07T14:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779005#M248056</link>
      <description>&lt;P&gt;Latest by modification timestamp, or by a timestamp coded into the filename?&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 19:19:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779005#M248056</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-07T19:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779046#M248076</link>
      <description>&lt;P&gt;i have used below script to get the latest csv file in directory :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the script is not working for me .can any one please help me resolve the issue.&lt;/P&gt;&lt;P&gt;filename file1 pipe "cd /folder/sub-folder ;ls -t | head -1" ;&lt;BR /&gt;libname file_ext 'cd /folder/sub-folder/file_ext' ;&lt;/P&gt;&lt;P&gt;data file_ext.file2_Read ;&lt;/P&gt;&lt;P&gt;infile file1 truncover ;&lt;BR /&gt;input filename $100 ;&lt;BR /&gt;put filename=;&lt;BR /&gt;/*&lt;BR /&gt;call symputx('lastfile',file1);&lt;BR /&gt;*/&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 05:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779046#M248076</guid>
      <dc:creator>Sandhya55</dc:creator>
      <dc:date>2021-11-08T05:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779057#M248085</link>
      <description>&lt;P&gt;Please answer my question.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 07:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779057#M248085</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-08T07:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779058#M248086</link>
      <description>Latest by modification timestamp</description>
      <pubDate>Mon, 08 Nov 2021 07:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779058#M248086</guid>
      <dc:creator>Sandhya55</dc:creator>
      <dc:date>2021-11-08T07:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779060#M248088</link>
      <description>&lt;P&gt;Your LIBNAME won't work; you can't use a UNIX command as a path&lt;/P&gt;
&lt;P&gt;Simplify your code first to see if you get the desired file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 pipe "cd /folder/sub-folder ;ls -t | head -1" ;

data _null_;
infile file1 truncover ;
input filename $100.;
put filename=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Read the log to see the filename; if you have issues, please copy/paste your log into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 07:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779060#M248088</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-08T07:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779063#M248089</link>
      <description>Thanks !!! latest file name is listed in filename .Can you please provide the syntax to read this file as we are dynamically getting the file name from directory</description>
      <pubDate>Mon, 08 Nov 2021 07:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779063#M248089</guid>
      <dc:creator>Sandhya55</dc:creator>
      <dc:date>2021-11-08T07:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779066#M248091</link>
      <description>&lt;P&gt;First, replace the PUT with the CALL SYMPUTX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 pipe "cd /folder/sub-folder ;ls -t | head -1" ;

data _null_;
infile file1 truncover ;
input filename $100.;
call symputx('fname',filename);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, define the target library, andv' read the file into a dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname file_ext '/folder/sub-folder/file_ext' ;

data file_ext.file2_Read ;
infile "/folder/sub-folder/&amp;amp;fname." dlm="," dsd truncover;
input
  /* insert variables to be read */
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Nov 2021 07:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779066#M248091</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-08T07:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to read latest csv file  from a directory present in unix using sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779079#M248096</link>
      <description>&lt;P&gt;You could further simplify the retrieval of the filename:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile "ls -t /folder/subfolder/*.csv" pipe truncover ;
input filename $200.;
call symputx('fname',filename);
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro variable should have the complete path in it, so you don't need to explicitly code it in the next data step.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 09:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-latest-csv-file-from-a-directory-present-in-unix/m-p/779079#M248096</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-08T09:04:29Z</dc:date>
    </item>
  </channel>
</rss>

