I have developed the following code which was working on SAS 9.2, but is now not working on SAS 9.3:
x '"C:\Program Files (x86)\Microsoft Office\Office14\excel.exe"'; |
data _null_; | ||
z=sleep(3); *Forces SAS to sleep for 3 seconds while Excel opens; | ||
run; |
filename ddecmds DDE "excel|sheet1!c1c7"; | ||
data _null_; | ||
file ddecmds; | ||
put '[workbook.activate("Sheet1")]'; | ||
put '[page.setup("&B&14&""Calibri""Supplemental Kit Evaluation Report (20 Samples)","Page &P",0.25,0.25)]'; | ||
put '[insert.picture("\\cpcsrv2\bdm\stats\iC42\Supplemental 20\Programs\ic42 logo6.bmp")]'; | ||
put '[format.size(476,80)]'; | ||
put '[select("C1")]'; | ||
put '[Column.Width(4)]%'; | ||
put '[select("C2")]'; | ||
put '[Column.Width(12)]%'; | ||
put '[select("C3")]'; | ||
put '[Column.Width(24)]%'; | ||
put '[select("C4:C6")]'; | ||
put '[Column.Width(12)]%'; | ||
put '[select("C7")]'; | ||
put '[Column.Width(13)]%'; | ||
run; |
Any suggestions?
By any chance are you running Cisco Jabber? That, and possibly a few other applications, interfere with DDE commands. If so, shut down Jabber. THEN use Task Manager to KILL the process still running.
I had some issues using the X command, which you may have an admin preventing you from using, to start Excel.
I use (with my very limited DDE experience)
%let rc=%sysfunc(system(start Excel));
/* wait to make sure excel is done starting, the number is seconds of delay
the value can be smaller for faster disk drives*/
%let rc=%sysfunc(sleep(2));
And a third place is I had to explicitly address the file format to match the version of Excel in a save command.
Most of my DDE commands later in the program are working. The X command is working fine. And the save command is working.
So which lines aren't running? Break it up and run it either line by line or binary search to see where the issue is.
My first check would be that the macro variables are resolving properly.
Is it the same version of Excel?
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.