| Date: | Wed, 1 May 2002 11:40:10 -0400 |
| Reply-To: | Ray Pass <raypass@ATT.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Ray Pass <raypass@ATT.NET> |
| Subject: | Re: FTP using SAS |
|
| In-Reply-To: | <1C82B8CC4567D51197A600508B62C13004E23E22@ban04xbindge.gein
d.ge.com> |
| Content-Type: | multipart/alternative;
|
|---|
Jeomoan et al, (orig post is below)
We do this by creating an FTP batch file which contains all the FTP
commands we want, and then executing it with a system command. This
example is UNIX-UNIX with an IP alias, but is easily adaptable to other
platform-platform situations. A snippet of code which should give you the
idea is as follows:
data _null_;
file 'ftpmput.ftp';
put 'debug on'
%do n=1 %to &mst_ct;
%let mst = %scan(&mst_all,&n,#);
/ "lcd /sasgrp1/rpm/html/plic/mp/&mst"
/ "cd /research/plic/mp/current/current/&mst"
/ 'mput *'
%end;
/ "lcd /sasgrp1/rpm/html/plic"
/ "cd /research/plic/mp/archives"
/ 'put calendar.htm'
/ "lcd /sasgrp1/rpm/html/plic"
/ "cd /research/plic/mp/current/current/downlds/"
/ 'put findaily.csv'
/ "lcd /sasgrp1/rpm/html/plic/mp/_STCNTY"
/ "cd /research/plic/mp/current/current/_STCNTY/"
/ 'mput *'
/ 'quit';
run;
*-----------------------------------------------------------------------------------;
%put sysexec ftp -i alps < &rpmprogs.ftpmput.ftp;
%sysexec ftp -i alps < &rpmprogs.ftpmput.ftp;
%put FTP mput RC IS: &sysrc;
%if &sysrc ne 0 %then %let ftperr = YES;
*-----------------------------------------------------------------------------------;
Of course, YMMV. GL & HTH.
Ray
----------
At 10:40 AM 05/01/2002 +0530, Kurian, Jeomoan T (CAP, ACOE) wrote:
>Dear All,
>
>I want to automate the FTP process using SAS in such a way that the program
>will push the specified files in to the web server. I could ftp a specified
>html file using the attached code but now I need all ftp functionalities
>like mput, mget, cd etc.
>
>Specifically, if I want to ftp an excel file or some other document, that
>too multiple files at a time, I am not sure how to simplify the ftp
>procedure in SAS.
>
>Thanks in advance,
>Jeomoan
>
>----------------the program I use to automate
>FTP------------------------------------------------------------------
>
>/* creating the local file which is an outcome of ODS Html*/
>
>ods html file= 'C:\A_working Documents\strategy\dashboard.html'
>style=version7;
>options CENTER;
>data update_list;
>set test.update_list;
>title1 'Details of Report Update';
>label
>task = 'Report Name'
>up_date = 'Last Update'
>gendate = 'Last Update'
>portfolio = 'Portfolio'
>group = 'Account Type';
>run;
>proc print data=update_list label;
>var Group portfolio task up_date ;
>run;
>ods html close;
>
>/* Reading the file into a sas recordset */
>
>filename htmlfile 'C:\A_working Documents\strategy\dashboard.html';
>data html;
> infile htmlfile truncover;
> input htmldata $char5000.;
>run;
>
>/*Pushing the file into webserver */
>
>filename update ftp "/docs/stratreports/dashboard.html" user="jeomoan"
>pass="xxxx" host="8.171.122.137";
>data _null_;
> file update;
> set html;
> put htmldata;
>run;
>
>
>
>
>"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
>ADDRESSEE and may contain confidential and privileged information.
>If the reader of this message is not the intended recipient,
>you are notified that any dissemination, distribution or copy of this
>communication is strictly Prohibited.
>If you have received this message by error, please notify us
>immediately, return the original mail to the sender and delete the
>message from your system."
*------------------------------------------------*
| Ray Pass, Ph.D. voice: (914) 693-5553 |
| Ray Pass Consulting eFax: (914) 206-3780 |
| 5 Sinclair Place cell: (914) 450-0555 |
| Hartsdale, NY 10530 e-mail: raypass@att.net |
*------------------------------------------------*
[text/html]
|