From: Nathaniel Wooding on
The problem may be that your code asks to associate the fileref with something that does not exist. Have you tried

data _null_;
file sas2xl;
put '[error(false)]';
put '[open("c:\mydir1\Myxls.xls")]';
filename sas2xl dde 'excel|system';
run;


-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Tom Quin
Sent: Wednesday, December 16, 2009 8:37 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: help needed on DDE 'excel|system'

Let me say the problem is that dde 'excel|system' does not work on my
computer. In my last example, fopen('sas2xl','s') does not work, causing SAS
not responding. Another example,
filename sas2xl dde 'excel|system';
data _null_;
file sas2xl;
put '[error(false)]';
put '[open("c:\mydir1\Myxls.xls")]';
run;

also makes SAS not responding.

I can use x command to start an excel file or x 'start Excel' to start
excel.

Why excel|system can not function on my computer?



On Wed, Dec 16, 2009 at 6:31 PM, Data _null_; <iebupdte(a)gmail.com> wrote:

> On 12/16/09, Tom Quin <tomquin99(a)gmail.com> wrote:
> > The problem is that, I think, SAS can not successfully send commands to
> > Excel throught filename DDE 'excel|system'.
>
> No, SAS can send commands to EXCEL through DDE but your program is not
> doing that.
>
> > I am not clear where the bug is, Windows, Office Excel, or SAS.
>
> The bug is in your program.
>
> What are you trying to do?
>
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
From: "Data _null_;" on
On 12/16/09, Tom Quin <tomquin99(a)gmail.com> wrote:
> Why excel|system can not function on my computer?

I don't know that it doesn't. You have not shown enough code to
convince me that you have done all the steps required to send commands
to EXCEL using DDE.

Here is a complete program that you may be able to test. It does....

1) Starts EXCEL
2) opens MYXLS.XLS workbook read only
3) determines the used range
4) clears formatting
5) reads 4 numeric fields
6) closes and quits, commented out for testing.

options noxwait noxsync;

data myxls;

*** Open EXCEL using ROPER code;
length fileref $8;
rc = filename(fileref,'EXCEL|SYSTEM','DDE');
put rc= fileref=;

fid = fopen(fileref,'S'); /* Check if Excel is open */
if fid le 0 then do; /* Excel is not open, open Excel
via Windows registry */
rc=system("Start Excel"); /* DOS command to open Excel*/
start = datetime(); /* Note start time */
stop = start + 5; /* Max time to try opening */
do while (fid le 0); /* Loop while Excel opens */
fid = fopen(fileref,'S'); /* Check if Excel is open */
time = datetime(); /* Reset current time */
if time ge stop then fid = time; /* Set FID to terminate loop*/
end; /* do while (fid le 0); */
end; /* Excel is not open, open Excel
via Windows registry */
rc = fclose(fid); /* Close fileopen on EXCEL */
rc = filename(fileref);
drop fileref rc fid start stop time;

*** Open a workbook and read from it after clearing the formatting.;

length ddetext $128;
link dummy1;
put '[OPEN(".\My SAS Files\9.1\Myxls.xls",0,"TRUE")]';
put '[SELECT.SPECIAL(5)]';
put '[CLEAR(2)]';

ddeText = 'excel|system!Selection';
infile dummy2 dde notab dlm='09'x dsd filevar=ddeText lrecl=256;
input selection:$128.;
putlog selection;

ddeText = cats('EXCEL|',selection);
infile dummy3 dde notab dlm='09'x dsd end=eof filevar=ddeText
lrecl=256 missover;
do while(not eof);
input (f1-f4)(:f16.);
output;
end;
link dummy1;
*put '[CLOSE("FALSE","FALSE")]';
*put '[QUIT()]';
stop;
dummy1:
ddetext = 'excel|system';
file dummy1 dde filevar=ddetext;
return;
run;
proc print;
run;
From: Tom Quin on
Thanks a lot for help.
Excel can not be started by fopen function or put [open] command through DDE
excel|system.

options noxwait noxsync;
filename sas2xl dde 'excel|system';
data _null_;

fid = fopen('sas2xl','s');
rc = fclose(fid);
run;

* now SAS becomes not responding;

I tried openning an excel file by X command, and then close it thru DDE. SAS
also becomes Not Respoding:
x '"C:\Program Files\Microsoft Office\Office11\excel.exe"';
data _null_;
x=sleep(6);
run;
filename cmds dde 'excel|system'; * up to now the code works good;
data _null_;
file cmds;
put '[QUIT()]';
run; * SAS becomes frozen;
I guess SAS perhaps is waiting for a return code from DDE but never get it.
Any idea ?

Thanks again.

On Thu, Dec 17, 2009 at 6:07 AM, Nathaniel Wooding <
nathaniel.wooding(a)dom.com> wrote:

> The problem may be that your code asks to associate the fileref with
> something that does not exist. Have you tried
>
> data _null_;
> file sas2xl;
> put '[error(false)]';
> put '[open("c:\mydir1\Myxls.xls")]';
> filename sas2xl dde 'excel|system';
> run;
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Tom
> Quin
> Sent: Wednesday, December 16, 2009 8:37 PM
> To: SAS-L(a)LISTSERV.UGA.EDU
> Subject: Re: help needed on DDE 'excel|system'
>
> Let me say the problem is that dde 'excel|system' does not work on my
> computer. In my last example, fopen('sas2xl','s') does not work, causing
> SAS
> not responding. Another example,
> filename sas2xl dde 'excel|system';
> data _null_;
> file sas2xl;
> put '[error(false)]';
> put '[open("c:\mydir1\Myxls.xls")]';
> run;
>
> also makes SAS not responding.
>
> I can use x command to start an excel file or x 'start Excel' to start
> excel.
>
> Why excel|system can not function on my computer?
>
>
>
> On Wed, Dec 16, 2009 at 6:31 PM, Data _null_; <iebupdte(a)gmail.com> wrote:
>
> > On 12/16/09, Tom Quin <tomquin99(a)gmail.com> wrote:
> > > The problem is that, I think, SAS can not successfully send commands to
> > > Excel throught filename DDE 'excel|system'.
> >
> > No, SAS can send commands to EXCEL through DDE but your program is not
> > doing that.
> >
> > > I am not clear where the bug is, Windows, Office Excel, or SAS.
> >
> > The bug is in your program.
> >
> > What are you trying to do?
> >
> CONFIDENTIALITY NOTICE: This electronic message contains
> information which may be legally confidential and or privileged and
> does not in any case represent a firm ENERGY COMMODITY bid or offer
> relating thereto which binds the sender without an additional
> express written confirmation to that effect. The information is
> intended solely for the individual or entity named above and access
> by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, distribution, or use of the
> contents of this information is prohibited and may be unlawful. If
> you have received this electronic transmission in error, please
> reply immediately to the sender that you have received the message
> in error, and delete it. Thank you.
>
From: Arthur Tabachneck on
Tom,

The following SAS note might not be relevant, but it's worth a try:

http://support.sas.com/kb/32/672.html

In short, unless you're on 9.2, there are known problems that might be
overcome by placing a sleep data step after EVERY dde data step. I'd
suggest trying that and letting the list know if it helped.

Art
-------
On Thu, 17 Dec 2009 15:55:16 -0500, Tom Quin <tomquin99(a)GMAIL.COM> wrote:

>Thanks a lot for help.
>Excel can not be started by fopen function or put [open] command through
DDE
>excel|system.
>
>options noxwait noxsync;
>filename sas2xl dde 'excel|system';
>data _null_;
>
> fid = fopen('sas2xl','s');
> rc = fclose(fid);
>run;
>
>* now SAS becomes not responding;
>
>I tried openning an excel file by X command, and then close it thru DDE.
SAS
>also becomes Not Respoding:
>x '"C:\Program Files\Microsoft Office\Office11\excel.exe"';
>data _null_;
> x=sleep(6);
>run;
>filename cmds dde 'excel|system'; * up to now the code works good;
>data _null_;
> file cmds;
> put '[QUIT()]';
>run; * SAS becomes frozen;
>I guess SAS perhaps is waiting for a return code from DDE but never get it.
>Any idea ?
>
>Thanks again.
>
>On Thu, Dec 17, 2009 at 6:07 AM, Nathaniel Wooding <
>nathaniel.wooding(a)dom.com> wrote:
>
>> The problem may be that your code asks to associate the fileref with
>> something that does not exist. Have you tried
>>
>> data _null_;
>> file sas2xl;
>> put '[error(false)]';
>> put '[open("c:\mydir1\Myxls.xls")]';
>> filename sas2xl dde 'excel|system';
>> run;
>>
>>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Tom
>> Quin
>> Sent: Wednesday, December 16, 2009 8:37 PM
>> To: SAS-L(a)LISTSERV.UGA.EDU
>> Subject: Re: help needed on DDE 'excel|system'
>>
>> Let me say the problem is that dde 'excel|system' does not work on my
>> computer. In my last example, fopen('sas2xl','s') does not work, causing
>> SAS
>> not responding. Another example,
>> filename sas2xl dde 'excel|system';
>> data _null_;
>> file sas2xl;
>> put '[error(false)]';
>> put '[open("c:\mydir1\Myxls.xls")]';
>> run;
>>
>> also makes SAS not responding.
>>
>> I can use x command to start an excel file or x 'start Excel' to start
>> excel.
>>
>> Why excel|system can not function on my computer?
>>
>>
>>
>> On Wed, Dec 16, 2009 at 6:31 PM, Data _null_; <iebupdte(a)gmail.com> wrote:
>>
>> > On 12/16/09, Tom Quin <tomquin99(a)gmail.com> wrote:
>> > > The problem is that, I think, SAS can not successfully send commands
to
>> > > Excel throught filename DDE 'excel|system'.
>> >
>> > No, SAS can send commands to EXCEL through DDE but your program is not
>> > doing that.
>> >
>> > > I am not clear where the bug is, Windows, Office Excel, or SAS.
>> >
>> > The bug is in your program.
>> >
>> > What are you trying to do?
>> >
>> CONFIDENTIALITY NOTICE: This electronic message contains
>> information which may be legally confidential and or privileged and
>> does not in any case represent a firm ENERGY COMMODITY bid or offer
>> relating thereto which binds the sender without an additional
>> express written confirmation to that effect. The information is
>> intended solely for the individual or entity named above and access
>> by anyone else is unauthorized. If you are not the intended
>> recipient, any disclosure, copying, distribution, or use of the
>> contents of this information is prohibited and may be unlawful. If
>> you have received this electronic transmission in error, please
>> reply immediately to the sender that you have received the message
>> in error, and delete it. Thank you.
>>
From: Nathaniel Wooding on
Tom=0D=0A=0D=0AMy usual approach is to launch Excel using an X command and =
as in the example that I believe that I sent you, I include the file to be =
opened at that time=2E I am not certain whether you can refer to the "syste=
m" until you have a workbook loaded=2E I would first try increasing the len=
gth of your sleep session=2E=0D=0A=0D=0ANat=0D=0A=0D=0AFrom: Tom Quin [mail=
to:tomquin99(a)gmail=2Ecom]=0D=0ASent: Thursday, December 17, 2009 3:55 PM=0D=
=0ATo: Nathaniel Wooding (Services - 6)=0D=0ACc: SAS-L(a)LISTSERV=2EUGA=2EEDU=
=0D=0ASubject: Re: help needed on DDE 'excel|system'=0D=0A=0D=0A=0D=0AThank=
s a lot for help=2E=0D=0AExcel can not be started by fopen function or put =
[open] command through DDE excel|system=2E=0D=0A=0D=0Aoptions noxwait noxsy=
nc;=0D=0Afilename sas2xl dde 'excel|system';=0D=0Adata _null_;=0D=0A=0D=0A =
fid =3D fopen('sas2xl','s');=0D=0A rc =3D fclose(fid);=0D=0Arun;=0D=0A=
=0D=0A* now SAS becomes not responding;=0D=0A=0D=0AI tried openning an exce=
l file by X command, and then close it thru DDE=2E SAS also becomes Not Res=
poding:=0D=0Ax '"C:\Program Files\Microsoft Office\Office11\excel=2Eexe"';=
=0D=0Adata _null_;=0D=0A x=3Dsleep(6);=0D=0Arun;=0D=0Afilename cmds dde 'e=
xcel|system'; * up to now the code works good;=0D=0Adata _null_;=0D=0A fil=
e cmds;=0D=0A put '[QUIT()]';=0D=0Arun; * SAS becomes frozen;=0D=0AI gues=
s SAS perhaps is waiting for a return code from DDE but never get it=2E An=
y idea ?=0D=0A=0D=0AThanks again=2E=0D=0AOn Thu, Dec 17, 2009 at 6:07 AM, N=
athaniel Wooding <nathaniel=2Ewooding(a)dom=2Ecom<mailto:nathaniel=2Ewooding@=
dom=2Ecom>> wrote:=0D=0AThe problem may be that your code asks to associate=
the fileref with something that does not exist=2E Have you tried=0D=0A=0D=
=0Adata _null_;=0D=0Afile sas2xl;=0D=0Aput '[error(false)]';=0D=0Aput '[ope=
n("c:\mydir1\Myxls=2Exls")]';=0D=0Afilename sas2xl dde 'excel|system';=0D=
=0Arun;=0D=0A=0D=0A=0D=0A-----Original Message-----=0D=0AFrom: SAS(r) Discu=
ssion [mailto:SAS-L(a)LISTSERV=2EUGA=2EEDU<mailto:SAS-L(a)LISTSERV=2EUGA=2EEDU>=
] On Behalf Of Tom Quin=0D=0ASent: Wednesday, December 16, 2009 8:37 PM=0D=
=0ATo: SAS-L(a)LISTSERV=2EUGA=2EEDU<mailto:SAS-L(a)LISTSERV=2EUGA=2EEDU>=0D=0AS=
ubject: Re: help needed on DDE 'excel|system'=0D=0A=0D=0ALet me say the pro=
blem is that dde 'excel|system' does not work on my=0D=0Acomputer=2E In my =
last example, fopen('sas2xl','s') does not work, causing SAS=0D=0Anot respo=
nding=2E Another example,=0D=0Afilename sas2xl dde 'excel|system';=0D=0Adat=
a _null_;=0D=0Afile sas2xl;=0D=0Aput '[error(false)]';=0D=0Aput '[open("c:\=
mydir1\Myxls=2Exls")]';=0D=0Arun;=0D=0A=0D=0Aalso makes SAS not responding=
=2E=0D=0A=0D=0AI can use x command to start an excel file or x 'start Excel=
' to start=0D=0Aexcel=2E=0D=0A=0D=0AWhy excel|system can not function on my=
computer?=0D=0A=0D=0A=0D=0A=0D=0AOn Wed, Dec 16, 2009 at 6:31 PM, Data _nu=
ll_; <iebupdte(a)gmail=2Ecom<mailto:iebupdte(a)gmail=2Ecom>> wrote:=0D=0A=0D=0A=
> On 12/16/09, Tom Quin <tomquin99(a)gmail=2Ecom<mailto:tomquin99(a)gmail=2Ecom=
>> wrote:=0D=0A> > The problem is that, I think, SAS can not successfully s=
end commands to=0D=0A> > Excel throught filename DDE 'excel|system'=2E=0D=
=0A>=0D=0A> No, SAS can send commands to EXCEL through DDE but your program=
is not=0D=0A> doing that=2E=0D=0A>=0D=0A> > I am not clear where the bug i=
s, Windows, Office Excel, or SAS=2E=0D=0A>=0D=0A> The bug is in your progra=
m=2E=0D=0A>=0D=0A> What are you trying to do?=0D=0A>=0D=0ACONFIDENTIALITY N=
OTICE: This electronic message contains=0D=0Ainformation which may be lega=
lly confidential and or privileged and=0D=0Adoes not in any case represent =
a firm ENERGY COMMODITY bid or offer=0D=0Arelating thereto which binds the =
sender without an additional=0D=0Aexpress written confirmation to that effe=
ct=2E The information is=0D=0Aintended solely for the individual or entity=
named above and access=0D=0Aby anyone else is unauthorized=2E If you are =
not the intended=0D=0Arecipient, any disclosure, copying, distribution, or =
use of the=0D=0Acontents of this information is prohibited and may be unlaw=
ful=2E If=0D=0Ayou have received this electronic transmission in error, pl=
ease=0D=0Areply immediately to the sender that you have received the messag=
e=0D=0Ain error, and delete it=2E Thank you=2E=0D=0A=0D=0A=0D=0A=0D=0ACONF=
IDENTIALITY NOTICE: This electronic message contains=0Ainformation which m=
ay be legally confidential and or privileged and=0Adoes not in any case rep=
resent a firm ENERGY COMMODITY bid or offer=0Arelating thereto which binds =
the sender without an additional=0Aexpress written confirmation to that eff=
ect=2E The information is=0Aintended solely for the individual or entity n=
amed above and access=0Aby anyone else is unauthorized=2E If you are not t=
he intended=0Arecipient, any disclosure, copying, distribution, or use of t=
he=0Acontents of this information is prohibited and may be unlawful=2E If=
=0Ayou have received this electronic transmission in error, please=0Areply =
immediately to the sender that you have received the message=0Ain error, an=
d delete it=2E Thank you=2E