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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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