Amos4は多変量データ行列と共分散(相関)行列の2種類を外部ファイルに指 定できる.多変量データに関しては通常のCSV形式で良い.共分散(相関)行 列については,Amos4の独特の約束がある.例えばフィールドに1個でも空白 文字が含まれると,そのフィールドは「文字変数」とみなされてしまう. マクロ%amos4 はSAS形式の共分散(相関)行列タイプのデータセットを Amos4形式で出力する.結果はテキストファイルであり,これをAmos4から指定 すると,そのまま分析可能になる.このデータに含まれる変数名も使用するこ とができる. %amos4 の中では,子マクロ %delblk を参照しているので,この子マクロも掲 載しておく.また %csv も参照しているが,これはWEB上に置いてある. %macro amos4( data = _last_ , /* 相関・共分散型のデータセット名 */ file = print , /* Amos4形式データ出力先の参照名 */ lrecl = 256 , /* 出力ファイルの論理レコード長 */ var = _numeric_ , /* 出力する変数名リスト */ drop =, delcorr = %str( if _type_ = 'CORR' then delete ; ) , if = ) ; /*--------------------------------------------------------- SAS DATASET (CORR|COV type) --> Amos4 text data file by T. SUZUKI ---------------------------------------------------------*/ options missing = ' ' ; data _x_ ; set &data ; if _type_ = "STD" then _type_ = "STDDEV" ; _name_ = upcase( _name_ ) ; rename _type_ = rowtype_ _name_ = varname_ ; &drop &delcorr &if run ; %csv( data = _x_, file = prt1, lrecl = &lrecl, n = no ) %delblk( infile = prt1 , file = &file , lrecl = &lrecl ) options missing = '.' ; %mend amos4 ; %macro delblk( infile = prt1, file = prt2, lrecl = 256 ) ; data _null_ ; infile &infile lrecl = &lrecl length = len ; file &file lrecl = &lrecl ; input x $varying200. len @ ; do c = 1 to len ; input @c a $char1. @ ; if a ne ' ' then put a $char1. @ ; end ; if c >= len then put ; run ; %mend delblk ;