06-09-2017 09:15 AM
I'm trying to use proc upload and download in sas studio but I'm having trouble.
I tried :
proc download infile="server/path/my_pgm.sas" outfile="D:\local_path\test.sas"; run;
proc upload infile="D:\local_path\test.sas" outfile="server/path/my_pgm.sas"; run;
But nothing happen and I have the following warning :
WARNING: PROC DOWNLOAD must be invoked with the RSUBMIT command.
If I use rsubmit/endrsubmit (which is weird as I'm already connected to my server).
i have the following error :
ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id. NOTE: Subsequent lines will be ignored until ENDRSUBMIT. ERROR: Remote submit to UNKNOWN canceled.
The previous code is working in SAS local with rsubmit/endrsubmit.
I don't understand why this is not working in sas studio without the rsubmit/endrsubmit;
Does anyone have an answer ?
Thank you !!
06-09-2017 09:33 AM
For PROC UPLOAD or DOWNLOAD to work you need to have two SAS sessions connected by a SAS connect session. When you run something in SAS/Studio you generally just have the one SAS session running. SAS/Studio itself is not running SAS. It is just a web interface. You can use the SAS/Studio interface to manually copy files, but you cannot get the SAS program to do that for you.
There are other ways depending on your environment.
If you are using SAS University Edition then your SAS session can only write to folders that are mapped to your virtural machine. And the SAS code will need to use the unix path for that folder and not the path that you would use from your real PC environment. No need to UPLOAD/DOWNLOAD just reference the file directly using the proper path.
Otherwise if you are running SAS on a Unix machine then perhaps you can used network drives that can be seen from both Unix and Windows machines. So you might have a network share that from a PC looks like \\servername\sharename\sasfiles and from UNIX it is mounted at /servername/sharename/sasfiles. Just use the right path on the right system.
Or you perhaps it would be better to setup an FTP server on your PC and allow the SAS process to use FTP to move files to and from your PC.
06-09-2017 09:35 AM
Thank you for your reply.
I don't have SAS University so I usually use FileZilla to transfer my files manually but I wanted to do it in an automatic way in codes.
Seems it's not possible
thank you again !!
06-09-2017 09:55 AM
One way could be this:
- install (or have installed) a (s)ftp server on your PC (ie https://filezilla-project.org/download.php?show_all=1&type=server)
- use the SAS server's sftp client to connect to it; set up public/private key authentication between your SAS server and your PC
- once that is running, you can use filename sftp from within SAS; or use the sftp client with X or filename pipe.
06-09-2017 10:59 AM
I believe that you can use FileZilla to setup an FTP server on your PC. Then your SAS code can simply use the FTP filename engine.
filename outfile "D:\local_path\test.sas" host='winnt.pc' user='bbailey' password='xxxx' ; data _null_; infile "/server/path/my_pgm.sas"; file outfile; input; put _infile_; run;
06-09-2017 09:41 AM
To be clear, before you had a local SAS session and communicated to a remote SAS server using SAS/CONNECT.
And now in SAS Studio, is that client started from the SAS Server or from the local PC SAS installation?
If you run SAS Studio from the server, you can't use SAS/CONNECT to move data from your local PC to the server, you need other means (ftp, shared file system/mapped network drive).