From: Sri on 6 Jul 2010 17:51 Hello All, I'm running a code that will open an excel file and writes data into it using DDE. I could open the file using X command, my excel has multiple tabs. I want to save the excel file and close the entire sheet once i'm done with updating the data. I found a code snippet on web, but my SAS is throwing errors, the very last part where i'm trying to close the file has an issue. I'm using 9.1.3 version. Any ideas to crack this will be highly appreciated. Here is my code: options noxwait noxsync; x '"c:\temp\SIU_FPA_CASES_BY_FCC.xls"'; data _null_; x=sleep(5); run; filename ddeopen1 DDE "Excel|system"; FILENAME OUT1_YR DDE "EXCEL|C:\temp\SIU_FPA_CASES_BY_FCC.xls\CW! R22C1:R22C5"; FILENAME OUT2_YR DDE "EXCEL|C:\temp\SIU_FPA_CASES_BY_FCC.xls\FB! R22C1:R22C5"; FILENAME OUT3_YR DDE "EXCEL|C:\temp\SIU_FPA_CASES_BY_FCC.xls\WB! R22C1:R22C5"; %macro addtab (num,fcc); data _null_; file out&num._yr; set siu_year_fcc; if fcc="&fcc"; by fcc; put FPA_YTD_&yr. FPA_&prev_yr. new_cases_YTD_&yr. new_cases_&prev_yr.; run; %mend addtab; %addtab (1,00); %addtab (2,05); %addtab (3,04); data _null_; length cmnd $ 70; file ddeopen1; cmnd='[save("c:\temp\'||"%trim(SIU_FPA_CASES_BY_FCC)"||'.xls")]'; put cmnd; put '[quit()]'; run; ERROR in log: NOTE: The file DDEOPEN1 is: DDE Session, SESSION=Excel|system,RECFM=V,LRECL=256 ERROR: DDE session not ready. FATAL: Unrecoverable I/O error detected in the execution of the data step program. Aborted during the EXECUTION phase. Thanks a lot in advance for looking into it. Regards Sri
|
Pages: 1 Prev: save your money and open all blocked sites now Next: PROC SQL SYNTAX ? |