BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6


Hello everyone,

I have a problem to update an exist excel file,I attached an excel file and use the SAS code below to update this file.

I have get a result not as my expected,because the old sheet a didn't replace by sashelp.class but create a new sheet named a1.

Please help

Thanks!

Mike

PROC EXPORT DATA=sashelp.class

OUTFILE = "C:\Temp\test8.xls"

DBMS = /*EXCEL2002*/excel REPLACE;

SHEET = "a";

RUN;

4 REPLIES 4
Linlin
Lapis Lazuli | Level 10

Mike,

I don't have any problem to run your code and replace the old same named file.

you can try the modified code:

libname myfile "C:\Temp\test8.xls";

proc sql;

  drop table myfile."a$"n;

quit;

libname myfile clear;

PROC EXPORT DATA=sashelp.class

OUTFILE = "C:\Temp\test8.xls"

DBMS = excel REPLACE;

SHEET = "a";

RUN;

Mike_Davis
Fluorite | Level 6

Hi linlin,

The problem still happen,

when I followed your method, firstly the drop table statement ONLY remove the content of sheet a  to an empty sheet(didn't delete the sheet but just replace it with an empty sheet)
then still create a new sheet named a1 using sashelp.clas.

Thank you

Mike

Reeza
Super User

http://support.sas.com/kb/20/923.html

If you scroll to the bottom of the the communities, in very small fine print you'll see how to open a track with tech support.

Mike_Davis
Fluorite | Level 6

FILENAME MyFile "C:\temp\aa\cc\test8.xls"  ;
  DATA _NULL_ ;
    rc = FDELETE('MyFile') ;
  RUN ;

FILENAME MyFile CLEAR ;


PROC EXPORT DATA=sashelp.class

OUTFILE = "C:\Temp\aa\cc\test8.xls"

DBMS = excel2002 REPLACE;

SHEET = "a";

RUN;

this will delete all sheet including b,c,but work for a

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1693 views
  • 6 likes
  • 3 in conversation