35 %macro mf_getVarFormat(libds
39 %local dsid vnum vformat rc vlen vtype;
41 %let dsid = %sysfunc(open(&libds));
42 %
if &dsid > 0 %then %
do;
44 %let vnum = %sysfunc(varnum(&dsid, &var));
46 %
if(&vnum > 0) %then %let vformat=%sysfunc(varfmt(&dsid, &vnum));
48 %put NOTE: Variable &var does not exist in &libds;
49 %let rc = %sysfunc(
close(&dsid));
54 %put dataset &libds not opened! (rc=&dsid);
59 %
if %length(&vformat)<2 & &force=1 %then %
do;
60 %let vlen = %sysfunc(varlen(&dsid, &vnum));
61 %let vtype = %sysfunc(vartype(&dsid, &vnum.));
62 %
if &vtype=C %then %let vformat=$&vlen..;
63 %
else %let vformat=8.;
68 %let rc = %sysfunc(
close(&dsid));