<?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 how to sftp files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36205#M7124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some sample code you can use for ftp (All macro variables have to be set to your reality):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename ftpcom "&amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Commands for ftp session;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt; file ftpcom pad;&lt;/P&gt;&lt;P&gt;* ftp session user and password;&lt;BR /&gt; put "user &amp;amp;user &amp;amp;pwd";&lt;/P&gt;&lt;P&gt; * Disable prompting cmd;&lt;BR /&gt; put 'prom no';&lt;/P&gt;&lt;P&gt;* Enable Binary transfer mode cmd;&lt;BR /&gt; put 'bin';&lt;/P&gt;&lt;P&gt;* Go to local folder cmd;&lt;BR /&gt; put "lcd &amp;amp;excel";&lt;/P&gt;&lt;P&gt;* Go to remote folder cmd;&lt;BR /&gt; put "cd &amp;amp;sharefolder";&lt;/P&gt;&lt;P&gt;* Get needed files cmd;&lt;BR /&gt; put 'mget *.tgz';&lt;BR /&gt; stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename doftp pipe "ftp -n &amp;amp;host &amp;lt; &amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;* Enable ftp session and pass it the commands file;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;infile doftp;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As said before, you can also use a Connect Session or create a NFS to the drive.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jan 2012 16:27:23 GMT</pubDate>
    <dc:creator>PAzevedo</dc:creator>
    <dc:date>2012-01-23T16:27:23Z</dc:date>
    <item>
      <title>how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36203#M7122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get a set of datasets from a remote server. And I am connected to a unix server as well. How to accomplish this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So task is getting a set of files or sasdatasets from a remote unix server to another unix server&amp;nbsp; using SAS commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;sasbase9&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 15:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36203#M7122</guid>
      <dc:creator>sasbasls</dc:creator>
      <dc:date>2012-01-23T15:25:44Z</dc:date>
    </item>
    <item>
      <title>how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36204#M7123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;lots of possibilities.&amp;nbsp; &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You could use the SAS 'X" command to launch an ftp script to do the copies.&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;If the datasets are all SAS datasets and you have SAS Connect running, you could use PROC COPY to move the datasets from one library to another.&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;Depending on the flavor(s) of Unix and local permissions, you might be able to NFS mount the directories on the remote Unix box and treat them as local.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I prefer #1 as it is simple and robust.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 15:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36204#M7123</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-01-23T15:36:06Z</dc:date>
    </item>
    <item>
      <title>how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36205#M7124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some sample code you can use for ftp (All macro variables have to be set to your reality):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename ftpcom "&amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Commands for ftp session;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt; file ftpcom pad;&lt;/P&gt;&lt;P&gt;* ftp session user and password;&lt;BR /&gt; put "user &amp;amp;user &amp;amp;pwd";&lt;/P&gt;&lt;P&gt; * Disable prompting cmd;&lt;BR /&gt; put 'prom no';&lt;/P&gt;&lt;P&gt;* Enable Binary transfer mode cmd;&lt;BR /&gt; put 'bin';&lt;/P&gt;&lt;P&gt;* Go to local folder cmd;&lt;BR /&gt; put "lcd &amp;amp;excel";&lt;/P&gt;&lt;P&gt;* Go to remote folder cmd;&lt;BR /&gt; put "cd &amp;amp;sharefolder";&lt;/P&gt;&lt;P&gt;* Get needed files cmd;&lt;BR /&gt; put 'mget *.tgz';&lt;BR /&gt; stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename doftp pipe "ftp -n &amp;amp;host &amp;lt; &amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;* Enable ftp session and pass it the commands file;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;infile doftp;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As said before, you can also use a Connect Session or create a NFS to the drive.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 16:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36205#M7124</guid>
      <dc:creator>PAzevedo</dc:creator>
      <dc:date>2012-01-23T16:27:23Z</dc:date>
    </item>
    <item>
      <title>how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36206#M7125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; One doubt--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does ﻿"&amp;amp;ftpcommands" in first filename statement correspond to ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again for help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:06:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36206#M7125</guid>
      <dc:creator>sasbasls</dc:creator>
      <dc:date>2012-01-25T09:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36207#M7126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;sasbasls wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One doubt--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does ﻿"&amp;amp;ftpcommands" in first filename statement correspond to ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again for help!&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;It's the name of the file you pass to the ftp session with the commands that will be executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a windows environment it would be something like: "c:\ftp_commands.txt".&lt;/P&gt;&lt;P&gt;On a unix environment it would be something like: "/home/sas/ftp_commands.txt".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to transfer files in an ftp session in batch you have to build your ftp commands file to pass to the ftp session, with the same commands you would use when typing directly in an ftp session.&lt;/P&gt;&lt;P&gt;Take this example and the sample i gave you with some modifications on macro variable names between two unix hosts:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want to transfer dataset "wanted.sas7bdat", placed in "/sasdata/source" on a remote server with ip "&lt;SPAN style="font-size: 10pt;"&gt;10.203.22.35", to "/sasdata/target" in the local server (where your sas session is invoked). The remote server ftp user is "sasftp" and the password is "12345". Your "ftpcommands" file will be built and stored in "/home/trash" folder in the local host.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;sample:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;filename ftpcom "&amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Commands for ftp session;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;file ftpcom pad;&lt;/P&gt;&lt;P&gt;* ftp session user and password;&lt;BR /&gt;put "user &amp;amp;user &amp;amp;pwd";&lt;/P&gt;&lt;P&gt;* Disable prompting cmd;&lt;BR /&gt;put 'prom no';&lt;/P&gt;&lt;P&gt;* Enable Binary transfer mode cmd;&lt;BR /&gt;put 'bin';&lt;/P&gt;&lt;P&gt;* Go to local folder cmd;&lt;BR /&gt;put "lcd &amp;amp;target";&lt;/P&gt;&lt;P&gt;* Go to remote folder cmd;&lt;BR /&gt;put "cd &amp;amp;source";&lt;/P&gt;&lt;P&gt;* Get needed files cmd;&lt;BR /&gt;put 'mget &amp;amp;wanted_files';&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename doftp pipe "ftp -n &amp;amp;host &amp;lt; &amp;amp;ftpcommands";&lt;/P&gt;&lt;P&gt;* Enable ftp session and pass it the commands file;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;infile doftp;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The macro variables for the sample code to work should look like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let &lt;/SPAN&gt;ftpcommands=/home/trash/ftp_commands;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let user=sasftp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let pass=12345;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let host=&lt;SPAN style="font-size: 10pt;"&gt;10.203.22.35;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let source=/sasdata/source;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let target=/sasdata/target;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let wanted_files=A.sas7bdat&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Since we're using mget ftp command to get the files we are allowed to use wildcards so, if the dataset was indexed you could use one wild card to bring both table and index with the same command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;%let wanted_files=wanted.sas7*;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;PA.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 10:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36207#M7126</guid>
      <dc:creator>PAzevedo</dc:creator>
      <dc:date>2012-01-25T10:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36208#M7127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can transfer by using some macro u need to craeate batch file for each file and need to give all credential for unix sever then u can transfer give me ur mail id i will send sample code for htis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 10:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36208#M7127</guid>
      <dc:creator>bachusudheer</dc:creator>
      <dc:date>2012-09-10T10:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36209#M7128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS has already supported sftp access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 02:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36209#M7128</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-09-11T02:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36210#M7129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the order of the code in which it must be created or executed?&lt;/P&gt;&lt;P&gt;You started with filename ftpcom "&amp;amp;ftpcommands".&lt;/P&gt;&lt;P&gt;Where is the above command be give?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 19:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/36210#M7129</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2012-12-12T19:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/403179#M97961</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you provide code example for using X command to launch fTP command? I cannot use command prompt and hoping to sftp files using user pwd using the X command.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Neha&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 14:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/403179#M97961</guid>
      <dc:creator>NehaMutta</dc:creator>
      <dc:date>2017-10-11T14:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792674#M253987</link>
      <description>&lt;P&gt;Could you provide an example x command to copy a text file using SAS Studio?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 21:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792674#M253987</guid>
      <dc:creator>sujaybshha</dc:creator>
      <dc:date>2022-01-26T21:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792684#M253992</link>
      <description>&lt;P&gt;From where to where? You need to explain your requirements more fully. Also it's not a good idea to add to 10 year old posts. You should create a new one.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 21:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792684#M253992</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-01-26T21:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to sftp files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792779#M254017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363665"&gt;@sujaybshha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Could you provide an example x command to copy a text file using SAS Studio?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In most environments i have access to, the xcmd is disabled in SAS Studio session. So you may want to check the status of xmcd:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=xcmd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jan 2022 07:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-sftp-files/m-p/792779#M254017</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-27T07:07:56Z</dc:date>
    </item>
  </channel>
</rss>

