<DDEでのnotabオプションの使用例>
【問題】セルに複数の単語からなる文字列を格納する。
option noxwait noxsync;
/*新規Excel open*/
x 'start excel';
/*テストデータ*/
data test_d;
length ver1 ver2 $12;
ver1="test one";
ver2="test two";
output;
run;
例1)notabオプションを使用しない。
filename test1 dde "excel|[book1]Sheet1!r4c1:r5c2";
data _null_;
file test1;
set test_d;
put ver1 ver2;
run;
※notabオプションを指定しないと、1列目に[test]、2列目に[one]が出力される。
例2)notabオプションを使用する(1つのセルに格納)。
filename test2 dde "excel|[book1]Sheet1!r4c1:r5c2";
data _null_;
file test2 notab;
set test_d;
put ver1 ver2;
run;
※notabオプションを指定すると、複数の単語からなる文字列を1つのセルに格納できる。
1列目に[test one test two]が出力される。
例3)notabオプションを使用する(各変数ごとに格納)。
filename test3 dde "excel|[book1]Sheet1!r4c1:r5c2";
data _null_;
file test3 notab dlm="09"x;
set test_d;
put ver1 ver2;
run;
※notabオプションを指定して、各変数を別々のセルに格納したい場合、各変数間にタブを入力して
出力するため、dlmオプションで区切り文字を"09"xに指定する。
1列目に[test one]、2列目に[test two]が出力される。
参考)いろいろなプログラムの書き方
filename test3 dde "excel|[book1]Sheet1!r4c1:r5c2" notab;
/*(1)*/
data _null_;
file test3 ;
set test_d;
put ver1 "09"x ver2;
run;
/*(2)*/
data _null_;
file test3 ;
ver1="test one";
ver2="test two";
put ver1 "09"x ver2;
run;
最終更新:2008年10月13日 00:08