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 (April 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 2 Apr 2009 07:59:59 -0400
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: EXCEL libname engine update existing sheet.
Comments:   To: "./ ADD NAME=data _null_;" <iebupdte@GMAIL.COM>

DataNull,

Define 'replace'. Look closer. Not efficient, like I said, but the method does use SAS statements to write additional observations to an existing sheet.

E.g.,

data test1; input var1 var2 var3; cards; 1 1 1 2 2 2 ;

PROC EXPORT DATA= WORK.test1 OUTFILE= "c:\test.xls" DBMS=excel2000 replace; sheet='test1'; RUN;

data test2; input var1 var2 var3; cards; 9 9 9 8 8 8 ;

PROC EXPORT DATA= WORK.test2 OUTFILE= "c:\test.xls" DBMS=excel2000 replace; sheet='test2'; RUN;

PROC IMPORT OUT= WORK.TEST1 DATAFILE= "c:\test.xls" DBMS=EXCEL2000 REPLACE; sheet='test1'; GETNAMES=YES; RUN;

data test1; do until (eof ne 0); set test1 end=eof; output; end; infile cards end=eof2; do until (eof2 ne 0); input var1 var2 var3; output; end; cards; 3 3 3 4 4 4 5 5 5 ;

PROC EXPORT DATA= WORK.test1 OUTFILE= "c:\test.xls" DBMS=EXCEL2000 REPLACE; sheet='test1'; RUN;

Art -------- On Wed, 1 Apr 2009 22:08:43 -0500, ./ ADD NAME=Data _null_; <iebupdte@GMAIL.COM> wrote:

>I have to add data to an existing sheet this method replaces the sheets. > >On 4/1/09, Arthur Tabachneck <art297@netscape.net> wrote: >> datanull, >> >> You only asked which methods are available, without any mention of >> efficiency. I don't know if anyone would really want to try the >> following, but it will accomplish the task: >> >> *Build test spreadsheet; >> data test; >> input var1 var2 var3; >> cards; >> 1 1 1 >> 2 2 2 >> ; >> >> PROC EXPORT DATA= WORK.test >> OUTFILE= "c:\test.xls" >> DBMS=excel2000 replace; >> RUN; >> >> *import the test spreadsheet; >> PROC IMPORT OUT= WORK.TEST >> DATAFILE= "c:\test.xls" >> DBMS=EXCEL2000 REPLACE; >> GETNAMES=YES; >> RUN; >> >> *add desired records; >> data test; >> do until (eof ne 0); >> set test end=eof; >> output; >> end; >> infile cards end=eof2; >> do until (eof2 ne 0); >> input var1 var2 var3; >> output; >> end; >> cards; >> 3 3 3 >> 4 4 4 >> 5 5 5 >> ; >> >> *export the modified spreadsheet; >> PROC EXPORT DATA= WORK.test >> OUTFILE= "c:\test.xls" >> DBMS=EXCEL2000 REPLACE; >> RUN; >> >> Art >> -------- >> On Wed, 1 Apr 2009 13:48:53 -0500, ./ ADD NAME=Data _null_; >> <iebupdte@GMAIL.COM> wrote: >> >> >What SAS statements can I use to write observations to and existing >> >sheet. e.g. ex.'Sheet1$'n. >> > >> >I can use SQL; INSERT INTO but I would like to know other alternatives >> >if they exist. >>


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