How to open excel file in Sas using _null_?

  • Follow


Hi To all,

   I'm trying to open excel file and iam writing code like this.

 %let ext_file = C:\Documents and Settings\Desktop\Athx.xls;

  filename ddemd dde 'excel|system';

  data _null_;
    file ddemd;
     put '[FILE-open("&ext_file")]';
    put '[QUIT()]';
  run;

 But Iam getting error in the log  "The file was not exist"

 Can you please help me out this, where iam wrong.


Thanks&Regards,
Hymad Sk
0
Reply hymadsk (80) 1/20/2010 1:46:36 PM

I prefer %sysexec to open files and delete them.  To close a file I usually use DDE

%let file="J6100.xls";
libname exbk excel &file;
Proc DataSets LIB=exbk nolist; Delete POS; Quit;
%inc fmt($DESCR);
DATA exbk.POS(drop=svscd DBLABEL=YES);
     retain Service FYTot Consumers;
     SET POS;
     Service=trim(SVSCD)||'-'||PUT(SVSCD,$DESCR.);
run;
libname exbk clear;

options noxsync noxwait;
%sysexec &file;
/*%sysexec del &file;*/


Inspect the file, run DDE, etc.


filename xl_out dde 'excel|system' notab;

data _null_;
file xl_out;
put '[save()]';
put '[quit()]';
run;

filename xl_out clear;


hope that helps

Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Shaik Hymad
Sent: Wednesday, January 20, 2010 5:47 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to open excel file in Sas using _null_?

Hi To all,

   I'm trying to open excel file and iam writing code like this.

 %let ext_file = C:\Documents and Settings\Desktop\Athx.xls;

  filename ddemd dde 'excel|system';

  data _null_;
    file ddemd;
     put '[FILE-open("&ext_file")]';
    put '[QUIT()]';
  run;

 But Iam getting error in the log  "The file was not exist"

 Can you please help me out this, where iam wrong.


Thanks&Regards,
Hymad Sk
0
Reply Paul.Choate (23) 1/20/2010 4:18:28 PM


1 Replies
234 Views

(page loaded in 0.055 seconds)

Similiar Articles:













7/14/2012 9:55:40 AM


Reply: