DDEを介してExcelファイルで検索と置換を行うSASプログラムを作成しようとしています。具体的には、ヘッダー行で文字列間のスペース (" ") を検索し、スペースなし ("") に置き換えようとしています。
たとえば、「Test Name」を含むセルがある場合、検索と置換を行って「TestName」にします。
これは私が持っているものです:
options noxwait noxsync;
/* Open Excel */
x '"C:\Program Files (x86)\Microsoft Office\Office14\excel.exe"';
filename cmds dde 'excel|system';
data _null_;
x=sleep(5);
run;
/* Open File and Manipulate*/
data _null_;
file cmds;
put '[open("C:\filename.xls")]';
put '[select("R1")]';
put '[formula.replace(" ","",1,,false,false)]';
run;
/*Close File*/
data _null_;
file cmds;
put '[FILE-CLOSE("C:\filename.xls")]';
put '[QUIT()]';
run;
検索と置換機能が機能していません。そのステートメントを読み取った後、ログに次のように表示されます。
NOTE: The file CMDS 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.
NOTE: 2 records were written to the file CMDS.
The minimum record length was 21.
The maximum record length was 70.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.63 seconds
cpu time 0.00 seconds
助言がありますか?
また、 Formula.replace ステートメントのパラメータが何であるかを知っている人はいますか? 最初と2番目があなたが見つけたいものであり、それを置き換えたいものであることを私は知っています. ドキュメントを見つけるのに苦労しています。