Hi Folks,
Can anyone help me with zipping the SAS programs. Which is the best way to zip SAS programs ?
Thanks !
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.
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
But you can't load program.sas.zip into SAS Studio's or Enterprise Guide's program editor, and you sure can't run
sas program.sas.zip
😉
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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: