BookmarkSubscribeRSS Feed
Alok_Pal
Quartz | Level 8

Hi There,

 

I have a SAS program that is generating a csv report file and writing it to one of the work directory on server. I want the created file to be copied or moved over to another directory on server. For this I added following lines of code to my existing code but it errors out with error message saying "Shell escape is not valid in this SAS session".

 

%let dir1="%sysfunc(pathname(work))/FileName..csv";
%let dir2="//FileServerName/Dir1/XYZ/Reports/";
%sysexec move "&dir1" "&dir2";

 

Any other work around/ suggestions are most welcome.

 

Thanks in advance.

2 REPLIES 2
Reeza
Super User

FCOPY  and/or PROC DOWNLOAD.

 

Yes, it's common for server side installations to restrict access to the OS, and using OS commands, which is your current approach. 

 

FCOPY uses SAS built in tools.

 

But if your SAS has access to the directory, you should be able to export directly to there in the first place?

snoopy369
Barite | Level 11
I guess you probably have this issue:
http://support.sas.com/kb/41/058.html

If you're running this in EG on a server, you'll need to talk to your SAS Admin about whether you can have the OPTIONS XCMD permitted or not. If not, you'll have to find another option for this (such as running this command in a command file, .bat in SAS or a shell script in unix).

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
  • 2 replies
  • 1149 views
  • 2 likes
  • 3 in conversation