Hi all,
finally I got it to sign to this community and a first question already came up:
I'm trying to transfer a file from SAS 9.3 on Windows via psftp to a Unix-Server.
I've written a dos-bat file "execute_cmd.bat" which contains the following ftp-commands:
cd /cid/test_folder
put d:\test\test.dat
quit
When I type in the dos-prompt the following line everything works fine and the file is transferred to the Unix server:
psftp av2 -batch -b d:\test\execute_cmd.bat ("av2" is a stored putty session for connection to the unix server).
When I try to execute this line of code within SAS Enterprise Guide (X commands are enabled):
X "psftp av2 -batch -b d:\test\execute_cmd.bat";
The Program ends fine, without error, but there is no file transferred to the Unix Server.
If I try to execute another .bat file e.g.: "doit.bat" wiht X "d:\test\doit.bat" which contains the following (non ftp) commands it works.
d:
cd d:\test
dir > testit.txt
Does anybody have a glue why my transfer isn''t working? I've already searched in google and read lots of related documents but unfortunately without success.
Thanks a lot for your help and kind regards,
Arnold
No idea about psftp, but if you use a PIPE in SAS then you can read the messages that the program might spit out.
filename getfiles pipe "psftp av2 -batch -b d:\test\execute_cmd.bat";
data _null_;
infile getfiles;
input;
list;
run;
the account which executes your SAS programs on the EG server might have different privileges (like psftp and putty and ... )
I'm confused by what you are saying you are trying to submit. Your command looks like it is trying to run the ftp program and having that program call the batch program.
If your batch program is already calling the ftp program, shouldn't you just be submitting the batch program? And, like Tom suggested, you might want to run the program via a pipe but, again, I think you simply want to run the batch program.
The program he listed is a series of FTP command, not DOS commands. He should give it a different extension because the .BAT extension might confuse Windows into think that it is an actual batch of DOS commands.
Thanks for the numerous answers.
It seems that it doesn't matter which ending the file containing the FTP commands has.
@Tom: The glue with the pipe is great. Now, I get the follwoing message into the Log:
<log-output>
Stderr output:
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 39:95:d4:82:cf:25:8f:92:9a:92:6a:23:4f:89:47:4f
Connection abandoned.
</log-output>
Now, I think I got the solution. I was logged in EG with a different user than the user logged on to the server, because the users usually are not allowed to log-on to the Win-Server. I have a SASADMIN windows user and was logged in Windows with this user. So the keys in the registry are stored under HKEY_CURRENT_USER. But when I use a different user in EG to execute the program the keys are not available to this user.
Any idea how to deal with this issue?
Thanks again for your support!
Any suggestions anybody?
Workaround could be to create a user profile for each user on the win-server and configure putty there. so the sessions are strored in the registry for each user and they can use the psftp transfer?
What do you think about this?
Does anybody have a auggestion how to deal with this?
Don't you use sftp transfers out of SAS EG for your personalized users or do they work with a common user for which the servers fingerprint is already stored?
Thanks for your collaboration!
Did you try using the FTP filename engine to just let SAS ftp the file for you?
Here is som examples with sftp. not sure whether it can work with psftp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.