BookmarkSubscribeRSS Feed
Codexgo
Fluorite | Level 6

Hi Folks,

 

Can anyone help me with zipping the SAS programs. Which is the best way to zip SAS programs ? 

 

Thanks !

 

4 REPLIES 4
Kurt_Bremser
Super User

Use the compression tool of your choice, outside SAS.

 

With SAS code, I would try

data _null_;
infile "path to somewhere/program.sas";
file "path to somewhere else/program.sas.zip" zip;
input;
put _infile_;
run;

 

Note that SAS cannot load zipped programs directly for execution.

yabwon
Onyx | Level 15

Hi @Codexgo ,

 

consider building a SAS Package: https://github.com/yabwon/SAS_PACKAGES

It gives you with some additional functionalities.

 

@Kurt_Bremser , you can use a zipped file:

/* program.sas is:
  Data _null_;
    put "Will zipped work??";
  run;
*/

filename in "C:/SAS_WORK/program.sas";
filename out ZIP "C:/SAS_WORK/program.zip" zip member="program.sas";

data _null_;
  infile in;
  file out;
  input;
  put _infile_;
run;

%include out(program.sas) / source2;

log:

1    /* program.sas is:
2      Data _null_;
3        put "Will zipped work??";
4      run;
5    */
6
7    filename in "C:/SAS_WORK/program.sas";
8    filename out ZIP "C:/SAS_WORK/program.zip" zip member="program.sas";
9
10   data _null_;
11     infile in;
12     file out;
13     input;
14     put _infile_;
15   run;

NOTE: The infile IN is:
      Filename=C:\SAS_WORK\program.sas,
      RECFM=V,LRECL=32767,File Size (bytes)=49,
      Last Modified=02Nov2020:14:30:14,
      Create Time=02Nov2020:14:29:38

NOTE: The file OUT is:
      Filename=C:\SAS_WORK\program.zip,
      Member Name=program.sas

NOTE: 3 records were read from the infile IN.
      The minimum record length was 4.
      The maximum record length was 27.
NOTE: 3 records were written to the file OUT.
      The minimum record length was 4.
      The maximum record length was 27.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


16
17   %include out(program.sas) / source2;
NOTE: %INCLUDE (level 1) file OUT(program.sas) is file C:\SAS_WORK\program.zip.
18  +Data _null_;
19  +  put "Will zipped work??";
20  +run;

Will zipped work??
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


NOTE: %INCLUDE (level 1) endin

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



yabwon
Onyx | Level 15

@Kurt_Bremser,

 

You just gave me an idea for brand new functionality to the SAS Packages Framework. 

A %previewPackage() macro which allows to print out all package code in the SAS session log (in contrary to %helpPackage, which only prints out the "help tagged" parts of the program file).

 

Thanks!! 🙂 🙂

 

bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 4 replies
  • 644 views
  • 2 likes
  • 3 in conversation