BookmarkSubscribeRSS Feed
janne_swe
Calcite | Level 5

Hi.

Read a lot of solution how to read testfiles from a zip-file.

I want to zip testfiles from a specifik folder to an compressed folder. But not all files in that folder, want to use the timestamp on the files.

ex in the folder: C:\logg\SASLogg

i have those files:

898989_242260_26SEP14.log

898989_242538_27OCT14.log

898989_242890_28NOV14.log

898989_242890_11DEC14.log

i want to use todays date and compress all files that is older than 7 Days alt or only the files that is 7 Days old.

Some one that have any ide how the SAS-code should look like?

BR

Jan

3 REPLIES 3
janne_swe
Calcite | Level 5

#Bump#

No one that has any ide how to do this?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Look up ods package.  With this you can create a ZIP file and add files into it.  It doesn't require a zip app installed, or OS calls:


ods package(MyPackage) open nopf;

ods package(MyPackage) add file="...\yourfile.log";

ods package(MyPackage) publish archive properties(archive_name="xyzzip" archive_path="c:\temp");

Kurt_Bremser
Super User

filename oscmd pipe 'dir C:\logg\SASLogg';

data _null_;

infile oscmd truncover;

format file_name $100.;

input;

file_name = scan(_infile_,1,'.');

file_date = input(substr(file_name,length(file_name)-6),date7.);

if (insert condition here) then call system(insert zip command here);

run;

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