SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
spjcdc
Calcite | Level 5

I've got several .sas files that I want to copy from one directory on the server to another.  I've got code like below that works fine, but each time it opens up the command window and I have to type 'quit' in each window to get it to go to the next one.

%let fromdir = Dev ;

%let todir = Test ;

%sysexec copy "\\my_server\&FromDir\Program 1.sas"  "\\my_server\&ToDir\Program 1.sas"  /y ;

%sysexec copy "\\my_server\&FromDir\Program 2.sas" " \\My_server\&ToDir\Program 2.sas  " /y ;

I'd be happy to create a .bat file to do this but I'm not convinced that I could get it to work.  When I type the command at the command prompt it says that it cannot find the file specified.  I've tried this with quotes and without quotes and with files without spaces in their names.  I guess I could map a drive letter to the path that I need and get the copy command to work in a .bat file, but if there's another way to do it using SAS so that the command window doesn't open up and have to be closed each time, I'd appreciate your telling me.

Thanks,

Steve

Steve James

Centers for Disease Control and Prevention

1 ACCEPTED SOLUTION

Accepted Solutions
FriedEgg
SAS Employee

options noxwait;

and try using xcopy instead of copy with the UNC path.  Mounting the network to a drive would work too.

View solution in original post

3 REPLIES 3
FriedEgg
SAS Employee

options noxwait;

and try using xcopy instead of copy with the UNC path.  Mounting the network to a drive would work too.

spjcdc
Calcite | Level 5

Thanks very much.  I hoped it would be simple.

Steve

Ksharp
Super User

Introducing a new function FCOPY() in SAS9.4

http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/

Xia Keshan

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2792 views
  • 0 likes
  • 3 in conversation