BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ClayZhai
Calcite | Level 5

Hi, I am using ods package to zip files in sas studio. From official website, I learned that name in the bracket is name aligned to ods package. But it seems this ods package name could be different from the final zip file name(here suppose it is 'newzip'). I need to create several zip files in the same prgramme, but when I reuse the ods package name, an error that this thread has been occupied happens. But after I relaunch sas studio, this pachage name could be used again, but still for once. Any solution? Or I have no way but to change the ods package name in the same pragramme every time when I want to create a new zip file? Thx.

ods package(newzip) open nopf;
ods package(newzip) add file=x1 path="data/";
ods package(newzip) add file=x2;
ods package(newzip) publish archive 
  properties(
   archive_name="xyz.zip" 
   archive_path="directory_name_here"
  );
ods package(newzip) close;
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Do you mean something like this? I find it works as expected, creating two zip files (xyz.zip and then xyz2.zip).

 

filename x1 "c:\temp\myfile.txt";
ods package(newzip) open nopf;
ods package(newzip) add file=x1 path="data/";
ods package(newzip) publish archive 
  properties(
   archive_name="xyz.zip" 
   archive_path="c:\temp"
  );
ods package(newzip) close;

filename x1 "c:\temp\myfile.txt";
ods package(newzip) open nopf;
ods package(newzip) add file=x1 path="data/";
ods package(newzip) publish archive 
  properties(
   archive_name="xyz2.zip" 
   archive_path="c:\temp"
  );
ods package(newzip) close;
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

1 REPLY 1
ChrisHemedinger
Community Manager

Do you mean something like this? I find it works as expected, creating two zip files (xyz.zip and then xyz2.zip).

 

filename x1 "c:\temp\myfile.txt";
ods package(newzip) open nopf;
ods package(newzip) add file=x1 path="data/";
ods package(newzip) publish archive 
  properties(
   archive_name="xyz.zip" 
   archive_path="c:\temp"
  );
ods package(newzip) close;

filename x1 "c:\temp\myfile.txt";
ods package(newzip) open nopf;
ods package(newzip) add file=x1 path="data/";
ods package(newzip) publish archive 
  properties(
   archive_name="xyz2.zip" 
   archive_path="c:\temp"
  );
ods package(newzip) close;
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1 reply
  • 826 views
  • 0 likes
  • 2 in conversation