Date: Fri, 1 Apr 2011 11:20:16 -0400
Reply-To: Arthur Tabachneck <art297@ROGERS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@ROGERS.COM>
Subject: Re: Opening Excel with SAS
Steve,
Your code works fine, repeatedly, for me. What statement are you actually
submitting to run your macro? I used:
%xlopen(file=c:\art\acogsa.xls)
If you are including a semicolon at the end of your statement that "might"
be causing the problem.
Art
--------
On Fri, 1 Apr 2011 08:27:02 -0500, Wall, Steven <steve.wall@PIONEER.COM>
wrote:
>SAS-L:
>
>I've been using a macro from Koen Vyverman and/or C.A. Roper (see below)
forever to open Excel files for DDE updating, but lately I've been having
trouble with it. It seems to work fine the first time I use it on a given
day, but then the next time I call it SAS just hangs. No error message
appears. It just stops and I have to X out of it. If I restart my PC, then
it will work again ONCE, but fail thereafter.
>
>Has anyone else seen this sort of behavior and, if so, how did you fix it?
>
>Using PC-SAS V9.2 on Windows XP on a Dell 64-bit machine.
>
>Thanks.
>Steve
>
>The macro:
>*--- From SUGI26: Paper 11 by Koen Vyverman via SUGI25 Paper 97 by C.A.
Roper
> Advantages over old way: no hard-coded part to the executable
> no SLEEP required;
>
>
>%MACRO XLOPEN(FILE=);
>
> options noxsync noxwait ;
>
> filename sas2xl dde 'excel|system' ;
>
> data _null_ ;
> length fid rc start stop time 8 ;
> fid = fopen('sas2xl','s') ;
> if (fid LE 0) then do ;
> rc = system('start excel') ;
> start = datetime() ;
> stop = start+10 ;
> do while (fid LE 0) ;
> fid = fopen('sas2xl','s') ;
> time = datetime() ;
> if (time GE stop) then fid = 1 ;
> end ;
> end ;
> rc = fclose(fid) ;
> run ;
>
> data _null_ ;
> file sas2xl ;
>
> put "[open(""&file"")]" ;
> run ;
>
>
>
>%MEND XLOPEN;
>
>
>
>This communication is for use by the intended recipient and contains
>information that may be Privileged, confidential or copyrighted under
>applicable law. If you are not the intended recipient, you are hereby
>formally notified that any use, copying or distribution of this e-mail,
>in whole or in part, is strictly prohibited. Please notify the sender by
>return e-mail and delete this e-mail from your system. Unless explicitly
>and conspicuously designated as "E-Contract Intended", this e-mail does
>not constitute a contract offer, a contract amendment, or an acceptance
>of a contract offer. This e-mail does not constitute a consent to the
>use of sender's contact information for direct marketing purposes or for
>transfers of data to third parties.
>
>Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean
>
> http://www.DuPont.com/corp/email_disclaimer.html
|