BookmarkSubscribeRSS Feed
CHAN07
Calcite | Level 5

Hello

 

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.

 

Thanks

 

5 REPLIES 5
CHAN07
Calcite | Level 5

Hey Reeza 

 

Thanks for the link. I am using this code:

 

FILENAME DIR FTP '       ' LS USER = '********************' HOST = '**************************' PASS = '######';

RUN;

 

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.

 

Thanks

Chandan Mishra

Reeza
Super User

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.

CHAN07
Calcite | Level 5

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.

Tom
Super User Tom
Super User

You need to SFTP instead of FTP if you are accessing an SFTP server.

 

http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p0xln1fiwsr340n1xxf4mkmfxp6f.htm&docs...

 

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2884 views
  • 0 likes
  • 3 in conversation