LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 29 Dec 2008 16:39:21 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: read excel through dde
Comments:   To: JP Zhu <zhujp98@GMAIL.COM>

Jeff,

Your code only tries to read 2 columns in 5 rows. That is likely the source of your current problem, as you indicate that you are trying to read 3 columns.

Art -------- On Mon, 29 Dec 2008 15:43:39 -0500, Jeff <zhujp98@GMAIL.COM> wrote:

> 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 >*


Back to: Top of message | Previous page | Main SAS-L page