i used to create password protected excel files in base SAS using DDE. Can any one guide me how to create password protected excel files in SAS EG, following code( got it from SAS support page) which i used in base SAS, this code doesn't work in SAS EG as DDE is not supported on SAS EG. my client is using SAS EG 6.1 which runs on SAS 9.4 %macro writpass(xlsfile1,xlsfile2,password,sasfile,deleteit); options macrogen symbolgen mprint nocaps; options noxwait noxsync; * First, SAS writes an Excel file here without the password. *; proc export outfile="&xlsfile1" data=&sasfile dbms=excel replace; run; quit; * This next routine starts the Excel application. *; filename cmds dde 'excel|system'; x "'C:\Program Files\Microsoft Office\Office11\excel.exe'"; data null; x=sleep(3); run; * SAS opens the Excel worksheet with its password. ;<br>filename cmds dde 'excel|system';<br>data null;<br> file cmds;<br> put '[open("'"&xlsfile1"'")]';<br>run;<br> SAS saves the file without the password. ;<br>data null;<br> file cmds;<br> put '[error("false")]';<br> put '[save.as("'"&xlsfile2"'",1,"'"&password"'")]'; <br> put '[quit]';<br>run;</code></p><p><code> Then SAS destroys the Excel file that is not password protected. *; %if &deleteit=yes %then %do; systask command "del ""&xlsfile1"" "; %end; %mend writpass; Thanks
... View more