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

Is there a way to password protect a file that is being built, zipped and emailed using ODS?

 

This is my current macro that builds the zip file and emails:

%macro zipemail(zpath=,spemail=,uemail=,workdate=,rptname=,fname=);

 

%if &syscc <= 4 %then %do;

ods package(&rptname.&workdate.) open nopf;

ods package(&rptname.&workdate.) add file="&zpath.&rptname.&workdate..xls" ;

     ods package(&rptname.&workdate.) publish archive

     properties(archive_name="&rptname.&workdate..zip"

     archive_path="&zpath.");

ods package(&rptname.&workdate.) close;

 

filename my_email email "&spemail"

        from="&uemail"

        subject="&fname"

        attach=("&zpath.&rptname.&workdate..zip"

                 content_type="application/zip");

 

data _null_ ;

file my_email;

run;

filename my_email clear;

%end;

%mend ;

 

Could code be added to password protect the report?  if so what is the code and where is it inserted?

 

TIA,

Elliott

1 ACCEPTED SOLUTION
5 REPLIES 5
Reeza
Super User
There's no built in way, as far as I know, but you can do this from the command line, so if you have XCMD enabled, you can pass that via command line.
Cynthia_sas
Diamond | Level 26
Hi:
If you were sending a PDF file as an attachment to your email, you could use the PDFPASSWORD option with ODS PDF as shown here: http://support.sas.com/documentation/cdl//en/lesysoptsref/69799/HTML/default/viewer.htm#n1e4a3l9txg8... but I do not believe there is an equivalent option for ODS EXCEL (or however you're making your XLS file).
Cynthia
Elliott
Obsidian | Level 7

I will look into that, we do currently use x commands to change the permissions on files.  we are running sas 9.4 on linux.

 

Thank you

Elliott
Obsidian | Level 7

I have been searching for hours trying to find unix code to password protect an existing file.  

 

Does anyone know what the x command should be to do that?

 

Thanks,

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