Date: Mon, 29 Dec 2008 15:43:39 -0500
Reply-To: Jeff <zhujp98@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jeff <zhujp98@GMAIL.COM>
Subject: read excel through dde
Content-Type: text/plain; charset=ISO-8859-1
id type label 98 Binary The occurrence of a "HUMAN IMMUNODEFICIENCY
VIRUS" claim during modeling year 167 Binary The occurrence of a "METABOLIC
COMPLICATIONS" claim due to diabetes during the modeling year
I have above excel file with 3 columns. I want ot read it to sas throught
dde. (We do not have import sas modules)
I used following code:
**
options noxwait noxsync;
x *'"c:\program files\microsoft office\office10\excel.exe"'*;
data _null_;
x=sleep(5);
run;
*;
/* open Excel workbook */
/*"N:\PM\PM_RF\CSVs\definitionT.csv" */
*;
filename ddecmd dde *'excel|system'*;
data _null_;
file ddecmd;
put *'[FILE-OPEN("N:\PM\PM_RF\CSVs\definitionT.xls")]'*;
run;
*;
/* specify desired Excel worksheet cell range */
*;
filename xlin DDE *'excel|definitionT!r2c1:r5c2'*;
run;
*;
/* read Excel files using DDE into SAS data set*/
*;
data test;
infile xlin dlm=*'09'x* notab missover dsd;
informat id 8. type $20. label $200.;
input id type label;
format id 8. type $8. label $200.;
run;
*;
/* close Excel workbook and close Excel */
data _null_;
file xlin;
put *'[FILE-CLOSE("N:\PM\PM_RF\CSVs\definitionT.xls")]'*;
put *'[QUIT()];
run;
This code can read "id" and "type" into sas dataset but failed to read
"label".(the varible name is in the resulting sas dataset test, but the
contents of lable is not there.
How can I fix this problem?
Thanks.
Jeff
*