BookmarkSubscribeRSS Feed
anurak
Fluorite | Level 6

I am using macro to zip all files in a folder. When i open the zip file, date of modified becomes the date I ran the macro. When I create zip files manually, date of modified preserves original files date. Here is the code I am using. How can i preserve the original modified date in zip file?

 

ods package(newzip) open nopf;

%do j = 1 %to &cnt;

ods package(newzip) add file="&dir.&&name&j" mimetype="application/x-compress";
ods package(newzip) publish archive properties(archive_name="&zipnme..zip" archive_path="&ziploc");

%end;

ods package(newzip) close;

2 REPLIES 2
agannon
Obsidian | Level 7

Retaining timestamps for ZIP files has been discussed before on SAS Communities: 

 

https://communities.sas.com/t5/New-SAS-User/Using-ODS-PACKAGE-to-create-ZIP-files-without-Changing-T...

Reeza
Super User
It looks like there's currently no method to do that with ODS Package but if your OS has a zip tool installed you can use that from within SAS to get the same output, usually you do need XCMD enabled though.

sas-innovate-wordmark-gradient-background 3.pngSAS Innovate

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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