BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Elwin1
Fluorite | Level 6
I have a few sas program from a directory which needs to be copied and placed in another directory. I have also tried X statement but while copying the timestamp is getting changes. So how do I ensure that timestamp doesn't get changed while copying
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

UNIX cp (and, IIRC, Windows copy) will create a new file with a new timestamp, unless you use the -p option (preserve attributes). mv, OTOH, will keep as much of the attributes as possible (depending on who runs it and who owns the original file).

View solution in original post

7 REPLIES 7
jimbarbour
Meteorite | Level 14

You're using SAS to copy the program?  I wouldn't use SAS.  I would use an operating system command.  Operating system commands will actually copy.  SAS is creating a new program that is a copy of the original, and the timestamp will reflect the time that the new program was created.

 

If you need to use SAS to manage when the copies are made, you can use SYSTASK or the X command to launch OS level commands from within SAS.

 

Jim

Elwin1
Fluorite | Level 6
I did trying using the X statement but the timestamp is getting changed. So
how do I preserve the timestamp as well.?
jimbarbour
Meteorite | Level 14

It's getting changed when using an X command?  That's unusual.

 

What operating system are you running under?  What command are you using?  Do the source and the target directories have the same operating system?  I've seen weird things happen if a UNIX directory is mapped to Windows.

 

Are the source and target directories in the same time zone?  For example my EG session is running in Pacific Time, but my SAS is running in Central Time.

 

Jim

Elwin1
Fluorite | Level 6
Thanks for you quick response. The target and the source has UNIX
environment
jimbarbour
Meteorite | Level 14

And what command specifically are you using to execute the copy?

 

Are there any peculiarities about either of these two UNIX environments?

 

In what way are the timestamps in error?  I assume that the copy has the date-time of when it was copied not the date-time of the original, is that correct?

 

Jim

Elwin1
Fluorite | Level 6
Got it. Need to use cp -p (It preserves the timestamp).. Thanks
Kurt_Bremser
Super User

UNIX cp (and, IIRC, Windows copy) will create a new file with a new timestamp, unless you use the -p option (preserve attributes). mv, OTOH, will keep as much of the attributes as possible (depending on who runs it and who owns the original file).

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!

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