読み込みとかだと こんな感じか? まだまだ これから検証してかないとですが
%macro imp_json(inpath=XXXX,ds=);
filename js "&inpath\&ds..json" encoding="utf-8";
libname in json fileref=js ;
proc copy in = in out = work ;
run ;
libname in clear ;
filename js clear;
data _null_;
set Itemgroupdata_ig_&ds.;
call symputx("name",name);
call symputx("label",label);
run;
data _null_;
set Ig_&ds._items end=eof;
call symputx( cats("rename",ordinal_items), cats("element",ordinal_items)||"="|| name );
call symputx( cats("label",ordinal_items), cats("element",ordinal_items)||"='"|| cats(label,"'") );
if ^missing(displayFormat) then do;
call symputx( cats("format",ordinal_items), cats("element",ordinal_items)||" "|| cats(displayFormat,"") );
end;
else do;
call symputx( cats("format",ordinal_items),"");
end;
if eof then call symputx("last_ordinal_items",ordinal_items);
run;
options mprint;
%macro create;
data &name(label="&label" drop=ordinal_IG_&ds ordinal_itemData ITEMGROUPDATASEQ);
set Ig_&ds._itemdata;
rename
%do i = 1 %to &last_ordinal_items;
&&rename&i
%end;
;
label
%do i = 1 %to &last_ordinal_items;
&&label&i
%end;
;
format
%do i = 1 %to &last_ordinal_items;
&&format&i
%end;
;
;
run;
%mend create;
%create;
%mend imp_json;
0 件のコメント:
コメントを投稿