DATA Step, Macro, Functions and more

Creating a file on SAS server when running PC SAS

Reply
N/A
Posts: 0

Creating a file on SAS server when running PC SAS

Hi all!

I want to create a file on the SAS server but I am running PC sas.
ERROR 180-322: Statement is not valid or it is used out of proper order.

298 quit;
endrsubmit;
Super User
Posts: 3,106

Re: Creating a file on SAS server when running PC SAS

Your program is running only the FILE statement on the server hence the error. An RSUBMIT must be done on a complete SAS step in exactly the same way as you run it on your PC. Try:

rsubmit SAS1;
proc upload data = data.schd out = schd;
run;

data _null_;
set schd end=eof;
file "servername/apps/jobs/test.sas" lrecl=2000;
put var1 var2 var3;
run;

endrsubmit;

This program will upload your PC dataset to the SAS server then run the step writing your data all on the server.
Valued Guide
Posts: 2,175

Re: Creating a file on SAS server when running PC SAS

"saskiwi"
one could "rsubmit" a step one line at a time and it won't "run" until a "run;" statement is rsubmitted (but it is hard to see when that would help) .

Here it looks like "sasnewbee" wants to write to the file in the server, directly.
Unfortunately there seems no equivalent to "remote library services" for files - unless the filename engines URL or FTP might help .. Of course the server hosting the sas connect server may not support these alternatives.
Additional alternatives to consider are sas integration technologies and sas intrnet both now part of the EBI platform ...
... anyone care to offer examples of these alternatives ?

regards
peterC
Super User
Posts: 3,106

Re: Creating a file on SAS server when running PC SAS

I agree it would be easier to write to the SAS server location directly from the PC. If the server were running Windows this would be dead easy as the file location would become:

\\servername\apps\jobs\test.sas

It looks like the server is running Unix judging by the directory name so unless the server has NFS (Network File System) enabled, I suspect for someone new to SAS a single remote submit uploading the data and writing it is going to be the simplest approach. Message was edited by: SASKiwi
Valued Guide
Posts: 2,175

Re: Creating a file on SAS server when running PC SAS

FILE statement is valid in a datastep.
Looks like the remote side is not in a datastep
Ask a Question
Discussion stats
  • 4 replies
  • 179 views
  • 0 likes
  • 3 in conversation