SASデータセット変数に割り当てられた出力形式を返します。
| カテゴリ: | SASファイルI/O |
%let dsid=%sysfunc(open(mydata, i));
%if &dsid %then
%do;
%let fmt=%sysfunc(varfmt(&dsid,
%sysfunc(varnum
(&dsid, NAME))));
%let rc=%sysfunc(close(&dsid));
%end;data vars;
length name $ 8 content $ 12;
drop dsid i num rc fmt;
dsid=open("mydata", "i");
num=attrn(dsid, "nvars");
do while (fetch(dsid)=0);
do i=1 to num;
name=varname(dsid, i);
if (vartype(dsid, i)='N') then do;
fmt=varfmt(dsid, i);
if fmt='' then fmt="BEST12.";
content=putc(putn(getvarn
(dsid,i),fmt),"$char12.");
output;
end;
end;
end;
rc=close(dsid);
run;