36%macro mf_getVarFormat(libds
40 %local dsid vnum vformat rc vlen vtype;
42 %let dsid = %sysfunc(open(&libds));
43 %
if &dsid > 0 %then %
do;
45 %let vnum = %sysfunc(varnum(&dsid, &var));
47 %
if(&vnum > 0) %then %let vformat=%sysfunc(varfmt(&dsid, &vnum));
49 %put NOTE: Variable &var does not exist in &libds;
50 %let rc = %sysfunc(close(&dsid));
55 %put &sysmacroname: dataset &libds not opened! (rc=&dsid);
56 %put &sysmacroname: %sysfunc(sysmsg());
61 %
if %length(&vformat)<2 & &force=1 %then %
do;
62 %let vlen = %sysfunc(varlen(&dsid, &vnum));
63 %let vtype = %sysfunc(vartype(&dsid, &vnum.));
64 %
if &vtype=C %then %let vformat=$&vlen..;
65 %
else %let vformat=best.;
70 %let rc = %sysfunc(close(&dsid));