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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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