Date: Tue, 9 Dec 2003 11:37:34 -0500
Reply-To: ben.powell@CLA.CO.UK
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: ben.powell@CLA.CO.UK
Subject: Re: SAS program as Telnet Client (newbie)
I'm not sure exactly what you're trying to do but think you want to use the
Unix machine as a drone from the SAS Windows machine. The only way I can
think of to get SAS to execute commands on the Unix shell is to ftp a
script made of %put statements over to the Unix box, and then run a vbs
script on the windows machine to issue commands through a terminal emulator
to execute the script in Unix. That is unless you cronned it? SAS could
then periodically (either seconds or minutes) check to see if the Unix
output file has materialised and then ftp it back.
I would be very interested to see what other methods there are for doing
this.
Below a sample ftp wait loop and a vbs sendkeys script that could be
executed with X.
/*LOOP AND WAIT FOR FILE.*/
filename one ftp '' cd='/path/' ls user='user'
host='host' pass='password';
proc printto log = 'P:\SAS\temp\waitlog.txt';run;
options nonotes nosource;
%macro wait;
%global nowdone;
%let nowdone = 0;
%let counter = 0;
%doagain:;
%let counter = %eval(&counter + 1);
proc printto;run;
options notes source;
%put WARNING: ftp WAIT... &counter;
proc printto log = 'P:\SAS\temp\waitlog.txt';run;
options nonotes nosource;
data _null_;
call sleep(15000);
run;
data _null_; infile one;
length x $25.;
input x $;
if x='OUTPUT.dat'
then call symput('nowdone','1');
run;
%if &nowdone.^=1 %then %goto doagain;
%mend;
%wait;
proc printto;run;
options notes source;
/*vbs script.*/
dim shell
set shell=CreateObject("WScript.Shell")
do while(shell.AppActivate("Tera Term")=FALSE)
wscript.sleep 200
loop
shell.sendkeys "user"
shell.sendkeys "{ENTER}"
wscript.sleep 750
shell.sendkeys "password"
shell.sendkeys "{ENTER}"
wscript.sleep 750
shell.sendkeys "mv OUTPUT.dat output.dat "
shell.sendkeys "{ENTER}"
wscript.sleep 750
shell.sendkeys "y"
shell.sendkeys "{ENTER}"
wscript.sleep 750
shell.sendkeys "exit"
shell.sendkeys "{ENTER}"
/*end vbs script.*/
On Tue, 9 Dec 2003 10:11:59 -0500, Carl Kyonka <Carl.Kyonka@ENBRIDGE.COM>
wrote:
>Hi,
>I want to run a few UNIX commands under control of a SAS program and FTP
>the result to my Windows system. The UNIX systems do not have SAS
>installed.
>I have SAS/Windows with SAS/Connect, but not SAS/Share.
>I have looked in on-line Doc, but most of it seems aimed at SAS to SAS
>communication.
>Could someone point me at the right doc?
>Thanks,
>Carl Kyonka