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