07-24-2017 11:34 PM
I download data from different vendors posted on SFTP every day. I have written a general program for each data as data layout structure for each data is same. So, everyday, I download and copy the data to a particular folder, run the program to read in the data and save the data to a particular folder. Is there any method to automate this so that I don't have to do the same boring stuff every day. So, basically I want a solution where the program will check if any new data is available, download it and save it to a particular folder, run the program at a particular time of the day and then save the SAS data to a folder. Please let me know.
07-24-2017 11:41 PM
07-26-2017 11:26 AM
Thanks for the link. I am using this code:
FILENAME DIR FTP ' ' LS USER = '********************' HOST = '**************************' PASS = '######';
In the log, it says the connection timed out. Since I am using WINSCP software to download the files, is it creating a problem because I didn't mention any software connection over here and it is trying to search the host on web.
07-26-2017 11:48 AM
WinSCP connects to a server using the same host/user and password information. Did you put in the same values from WinSCP into the FILENAME statement.
Not sure why you think you need to have a 'software connection'. The idea should be to bypass WinSCP to get the file directly.
07-31-2017 05:31 PM
I am still trying to read in the files using the method available on SAS community. I have used all the processes but not able to log into the SFTP system even though I can log in normally. I will keep you posted.
07-31-2017 07:03 PM
You need to SFTP instead of FTP if you are accessing an SFTP server.
Even then you might need to do something to allow you to connect. Sign on to the host where SAS is running and see if you can connect to the SFTP host using the sftp command line program.
You might need to automate the download parts by calling the sftp commands via the SYSEXEC or X commands or by using PIPE engine on a filename.
You also might want to look into using curl to retrieve the files instead of native sftp commands. That should give you a lot more flexibility in automating the login process.