BookmarkSubscribeRSS Feed
elisa_s
Fluorite | Level 6

Hello,

 

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;

 

and 

 

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 !!

 

 

7 REPLIES 7
Tom
Super User Tom
Super User

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.  

elisa_s
Fluorite | Level 6

Hi Tom,

 

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 !!

 

Kurt_Bremser
Super User

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.

Tom
Super User Tom
Super User

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;
elisa_s
Fluorite | Level 6
I think i'm gonna try !

Thankss
LinusH
Tourmaline | Level 20

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).

Data never sleeps
elisa_s
Fluorite | Level 6
Thanx Lush.

I think that the client is started from the SAS server that's why it's not working...

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 4185 views
  • 1 like
  • 4 in conversation