<?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 do I use SAS eg to import the only CSV file in SFTP folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325203#M271387</link>
    <description>&lt;P&gt;I don't think it's possible to use the SAS directory functions over SFTP.&lt;/P&gt;
&lt;P&gt;So I'd use an external SFTP utility to extract all files found to a local directory (clean it out first!), and then use the SAS directory functions to retrieve the filename.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2017 09:22:40 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-01-17T09:22:40Z</dc:date>
    <item>
      <title>How do I use SAS eg to import the only CSV file in SFTP folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325197#M271385</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to read a CSV file from a SFTP folder. The customers have instructed that the filename would vary day to day due to a datetime stamp in the file name. However the file that needs to be imported into SAS will be the only file sitting in the SFTP folder everyday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get SAS to import the only file that is sitting in this SFTP folder instead of having to specify the filename explicitly? I'm on version 7.1 btw.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325197#M271385</guid>
      <dc:creator>hotprawnstar</dc:creator>
      <dc:date>2017-01-17T09:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use SAS eg to import the only CSV file in SFTP folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325200#M271386</link>
      <description>&lt;P&gt;Personally, if I was paying them to send me data I would be telling them how to provide the data. &amp;nbsp;Hence my import agreement would define structure, content, and delivery details which they would then sign and abide by. &amp;nbsp;As part of the delivery details I would instruct them to name the file the same each time, without filename modifications, so you wouldn't need to worry about that (and your version control system would be able to handle this text file).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325200#M271386</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-17T09:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use SAS eg to import the only CSV file in SFTP folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325203#M271387</link>
      <description>&lt;P&gt;I don't think it's possible to use the SAS directory functions over SFTP.&lt;/P&gt;
&lt;P&gt;So I'd use an external SFTP utility to extract all files found to a local directory (clean it out first!), and then use the SAS directory functions to retrieve the filename.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325203#M271387</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-17T09:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use SAS eg to import the only CSV file in SFTP folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325334#M271388</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try to use the LS option coming with the SFTP method of FILENAME?&lt;/P&gt;
&lt;P&gt;From the&amp;nbsp;&lt;STRONG&gt;SAS® 9.4 Statements: Reference, Fifth Edition&lt;/STRONG&gt; and its &lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm" target="_self"&gt;FILENAME Statement, SFTP Access Method&lt;/A&gt;&amp;nbsp;chapter, we have:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6761i6D512A25A2DBE1D5/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="LS.JPG" title="LS.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other options such as LSFILE, etc. might help you too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From that same page, you'll also have access to &lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm" target="_self"&gt;Exemple 4: Reading Files from a Directory on the Remote Host&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;This can be done after you retrieved the file name:&lt;/P&gt;
&lt;DIV id="n1clksn9ohsm2xn1r7wgwvmgqviu" class="xis-paragraph"&gt;This example reads the files &lt;CODE class="xis-codeDefaultStyle"&gt;test.dat&lt;/CODE&gt; and &lt;CODE class="xis-codeDefaultStyle"&gt;test2.dat&lt;/CODE&gt; from a directory on the remote host.&lt;/DIV&gt;
&lt;DIV id="p10ikcq9z3tdlmn1ivpr12ni42hf" class="xis-codeBlock"&gt;
&lt;PRE class="xis-code"&gt;filename infile sftp '/users/xxxx/' host="unixhost1" dir;
data _null_;
   infile infile(test.dat) truncover;
   input a $25.;
   infile infile(test2.dat) truncover;
   input b $25.;
run;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;(Sorry I can't test, i don't have a SFTP available).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt;Damo&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-SAS-eg-to-import-the-only-CSV-file-in-SFTP-folder/m-p/325334#M271388</guid>
      <dc:creator>Damo</dc:creator>
      <dc:date>2017-01-17T16:39:51Z</dc:date>
    </item>
  </channel>
</rss>

