Date: Wed, 17 Sep 2008 08:54:00 -0400
Reply-To: Nathaniel.Wooding@DOM.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject: seeking information on DDE. was hi
In-Reply-To: <fa12e989-26ae-4df7-9a8a-23b0ab996dce@b38g2000prf.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
First, welcome to the world of SAS. Not to pick on you but please offer a
more explanatory subject line than "Hi" since it was pure luck that I even
opened your posting.
As to DDE, what are you trying to do? Do you want to read data or write?
Are you working with Excel or Word or what?
I should also why you want to use DDE. While I use the tool, there are
newer methods of reading data from Excel into SAS and you may want to
explore these.
One thing to remember with DDE is that it operates while both SAS and the
target software are running. Hence, if you are reading data from Excel,
Excel has to be running and the spreadsheet loaded.
Here is a sample job that reads data from a spreadsheet. There are fancier
ways to launch Excel but the one that I show works.
DM 'OUTPUT;CLEAR;LOG;CLEAR;PGM;';
*/
OPTIONS NOXWAIT NOXSYNC MPRINT; * NOTE THE NOXWAIT AND NOXSYNC!!;
/* THE DDE LINK IS ESTABLISHED WITH EXCEL */
DATA _NULL_ ; * YOU MAY HAVE EXCEL STORED UNDER A DIFFERENT PATH;
X " 'C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE11\EXCEL.EXE'
""C:\PARK\97JUN.XLS"" ";** THIS IS THE FILE TO OPEN
*OPEN EXCEL;
RUN;
DATA _NULL_;
X=SLEEP(5); * PAUSE SAS PROCESSING FOR 5 SECONDS WHILE EXCEL OPENS AND
LOADS THE SHEET;
DATA A;
FILENAME GETDATA DDE "EXCEL|COND001!R5C2:R32C15"; * NOTE THE ROWS AND
COLUMNS. COND1 IS
THE WORKSHEET;
*THE PORTION AFTER THE | IS
THE DDE TRIPLIT;
INFILE GETDATA DLM='09'X NOTAB DSD MISSOVER; * NOTE THE DLM. THIS SEPARATES
EXCEL FIELDS;
INFORMAT COL1 -COL11 $20.;
INPUT COL1-COL11;
DATA _NULL_;** SHUT DOWN EXCEL;
FILENAME CMDS DDE 'EXCEL|SYSTEM';
FILE CMDS;
put '[error(false)]';
put '[file.close(false)]';
PUT '[QUIT()]'; * THIS IS AN EXCEL VERSION 4 MACRO.;
RUN;
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
sreekumar435@GMAI
L.COM
Sent by: "SAS(r) To
Discussion" SAS-L@LISTSERV.UGA.EDU
<SAS-L@LISTSERV.U cc
GA.EDU>
Subject
hi
09/17/2008 07:22
AM
Please respond to
sreekumar435@GMAI
L.COM
i am new bie to sas, i am strugling with dde option
can tell me syntax and hw to use that
bye
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.