Hi
We have a SAS macro which takes a data set as an input and creates a file reference to an xls file of the corresponding data set and we have another macro which takes the file reference created by the previous macro as input and emails the xls file, we now save the file from the email to our local drive. I am starting to think if there is a way to store the file directly to a local drive instead of emailing, I heard FTP option in File name statement can do this, but not sure how exactly I can use that. We write SAS programs in Mainframe.
Any help would be much appreciated!!
Thanks!!
I have tried two ways of doing it. 1). For flat file: filename ftp : SAS(R) 9.3 Statements: Reference or safer verions, sftp: SAS(R) 9.3 Statements: Reference , or both will require client software installed, SAS is only providing a convenienct interface. We are right now using axway protocol Cross File Transfer - Wikipedia, the free encyclopedia I am not aware of the support from filename statement. 2) For SAS tables, Cport file download: Since you have SAS on Mainframe like we do, here is our work flow to transfer mainframe SAS tables onto Windows SAS server: proc cport (Mainframe) -> axway -> proc cimport (Windows server). It can do the whole library. The whole job was managed using CA7.
HTH,
Haikuo
If you want to send an email from your SAS Server you need an Email Server. SAS sending the email is here on the client side. The same is true for FTP. So in order to FTP something from your SAS process you need to connect to an FTP server.
This FTP server then needs write access to the C-drive of the Workstation. That's normally only possible if an FTP server runs on the Workstation. I've done such stuff in the past "playing around" but having an FTP server running on a Workstation is not something you can reasonably expect in a commercial environment.
What could be available is an FTP server “somewhere” which can write to a file server which you then could map on the workstation (or access via UNC path).
Mainframe stuff is quite a while ago for me but there used to be a Unix environment (USS) on the Mainframe to which we could write our stuff – and USS was then accessible from Windows via SAMBA. The architecture and terminology might have changed/modernised a bit since my Mainframe days but I’m sure the general approach as such will still work.
We routinely use Patrick's approach for transferring files from the mainframe to the PC. It is particularly helpful for us, as the PC people do not have mainframe accounts. The program on the mainframe creates the output product and FTPs it to an FTP server that we have mutual access to. The PC then connects to the same FTP server and moves the data to the PC world for further processing. We do the same thing in our *nix environments. The various batch jobs are run with the task scheduling tools that come with the different hosts. The last step includes an e-mail to me so I know if everything worked OK.
Doc Muhlbaier
Duke
Hi:
I remember doing this quite a while ago.
You should check you mainframe SAS components and see if you have SAS/Connect installed. If you do you can use it
to connect to a FTP client on the Windows machine (we got our client from the internets). Then you can connect
from the mainframe batch job that creates the .xls file to the PC and use PROC UPLOAD to transfer the file to the PC.
As noted, you will need a directory where you have permissions to write and you must transfer the file in binary or
the resulting file on the PC will be unusable.
Anyhow - that's how we got it working.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: