BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

Please, I have a text files( f1_g.txt, f2_m.txt, .  fm_g.txt  ..fn_y.txt)  in the directory W1 and I want to copy some of them in the directory W2.

1- I want only to copy some of them (f1_g.txt, fm_g.txt....) from the directory W1 to the directory W2

2- I will make a copy from Unix to windows and from also windows to unix.

3- I do not want to use the x command( exemple : x cp f1 /w2). I want to use a sas program for all os.

Thank you.

7 REPLIES 7
Reeza
Super User

1. Obtain a list of files in the directory

http://www.wuss.org/proceedings12/55.pdf

1b. Filter based on criteria required - unspecified in question

2. Copy the file using the method specified here - byte by byte copying.

http://blogs.sas.com/content/sasdummy/2011/06/17/how-to-use-sas-data-step-to-copy-a-file-from-anywhe...

LineMoon
Lapis Lazuli | Level 10

Thank you for your answer

Reeza
Super User

There is also the FCOPY function in SAS 9.4 at least. Not sure about earlier versions.

TomKari
Onyx | Level 15

Generally you can't access Windows and Unix directories from the same computer, unless some arrangement has been made using something like Samba to mount the dissimilar type. Has this been done in your case?

Tom

LineMoon
Lapis Lazuli | Level 10

Thank you for your message.

Is this been done in my case? non

Kurt_Bremser
Super User

To copy files between systems when there is no mapped-drive connection requires SAS (with SAS/CONNECT licensed) to be present on both systems.

If you don't have that, your only other option is using a file copy method like SFTP, which requires external commands with the X statement or system() function or call system() subroutine.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would also suggest this sounds more like an FTP request.  TBH if your not sure I would contact your IT support and have them setup file transfers/shared areas for you as you can run into all kinds of difficulties. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 3353 views
  • 11 likes
  • 5 in conversation