Hello Everyone,
Can some one help me as how to add the password for the zip file to open:
Following is my programming, please suggest -
%LET DIRECTORY=%SCAN(&sysparm,1,%STR( ));
FILENAME INFILES "&directory";
FILENAME EXELOG "&directory\LOGLIS\&sysdate9..LOG";
LIBNAME OUTLIB V8 "&directory";
data _null_;
call symput('date',(put(date(),yymmddn8.)));
run;
/* ods begin */
ods package(ProdOutput) open nopf;
ods package(ProdOutput)
add file= "&directory\DONKEY_XX_Conc_HHHH_%sysfunc(today(),YYMMDDN8.).csv";
ods package(ProdOutput)
publish archive
properties
(archive_name= "DONKEY_XX_%trim(&date.).zip"
archive_path="&directory");
ods package(ProdOutput) close;
/* ods end */
FILENAME OUTLIS "&directory\LOGLIS\check.LIS";
/* delete original files after creating the zip file */
FILENAME fileref1 "&directory\DONKEY_XX_Conc_HHHH_%sysfunc(today(),YYMMDDN8.).csv";
%put %sysfunc(fdelete(fileref1));
FILENAME fileref1 "&directory\DONKEY_XX_Conc_HHHH_%sysfunc(today(),YYMMDDN8.).csv";
%put %sysfunc(fdelete(fileref1));
PROC PRINTTO PRINT=OUTLIS NEW;
RUN;
You may find this post helpful.
https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-ODS-to-password-protect-file/td-p/509182
By the way, I have done the process of adding passwords using 7zip in a Windows environment, as shown in the url posted by reeza.
Please provide your environment first.
Why is it of no use?
Just create the zip file and then run the command.
If you want to include it in your program, it should be before "PROC PRINTTO PRINT=OUTLIS NEW;".
On Windows, it can be rewritten as follows.
7zip will create the zip file, so no ods statement is needed.
options noxwait xsync;
data _null_;
call symput('date',(put(date(),yymmddn8.)));
run;
x " ""C:\Program Files\7-Zip\7z"" a
""&directory\DONKEY_XX_%trim(&date.).zip""
""&directory\DONKEY_XX_Conc_HHHH_%trim(&date.).csv""
-pPASSWORD";
You can modify the 7zip path if necessary.
I am getting this error and not able to append the password.
x " ""E:\Program Files\7-Zip\7z"" a
""&directory\DONKEY_XX_%trim(&date.).zip""
WARNING: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation marks.
""&directory\DONKEY_XX_Conc_Result_%trim(&date.).csv""
-pPASSWORD"
! ;
how to solve this.
How many characters is the folder path assigned to &directory?
Also, what happens if I don't use the macro variable and specify the actual folder?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.