38 %macro mm_createdataset(libds=,tableuri=,outds=work.mm_createdataset,mDebug=0);
39 %local dbg errorcheck tempds1 tempds2 tempds3;
40 %
if &mDebug=0 %then %let dbg=*;
43 %
if %index(&libds,.)>0 %then %
do;
45 data;run;%let tempds1=&syslast;
46 %mm_getlibs(outds=&tempds1)
49 if upcase(libraryref)=
"%upcase(%scan(&libds,1,.))";
50 call symputx(
'liburi',LibraryId,
'l');
53 data;run;%let tempds2=&syslast;
54 %mm_gettables(uri=&liburi,outds=&tempds2)
57 if upcase(tablename)=
"%upcase(%scan(&libds,2,.))";
58 call symputx(
'tableuri',tableuri);
62 data;run;%let tempds3=&syslast;
63 %mm_getcols(tableuri=&tableuri,outds=&tempds3)
66 set &tempds3 end=last;
67 if _n_=1 then call execute(
'data &outds;');
70 if SAScolumntype=
'C' then type=
'$';
71 attrib=
'attrib '!!cats(colname)!!
' length='!!cats(type,SASColumnLength,
'.');
73 if not missing(sasformat) then fmt=
' format='!!cats(sasformat);
74 if not missing(sasinformat) then infmt=
' informat='!!cats(sasinformat);
75 if not missing(coldesc) then desc=
' label='!!quote(cats(coldesc));
77 attrib=trim(attrib)!!fmt!!infmt!!desc!!
';';
80 if last then call execute(
'call missing(of _all_);stop;run;');