30%macro mf_getvalue(libds,variable,filter=1,fetchobs=1,warn=0
32 %local dsid rc vartype;
34 %let vartype = %mf_getvartype(&libds,&variable);
36 %let dsid=%sysfunc(open(&libds(where=(&filter))));
37 %
if (&dsid) %then %
do;
39 %let rc = %sysfunc(fetchobs(&dsid,&fetchobs));
40 %
if (&rc ne 0) %then %
do;
41 %put %sysfunc(sysmsg());
44 %
if (&vartype eq N) %then %let &variable = .;
45 %
if (&warn) %then %
do;
46 %
if (&rc eq -1) %then %
do;
49 %quote(WARN%str(ING): Missing value returned as no rows were)
50 %quote(found in &libds for filter (%superq(filter)))
51 %quote(and/or fetchobs (&fetchobs).)
58 %let syscc = %sysfunc(max(&syscc,&rc));
60 %let rc = %sysfunc(close(&dsid));
66 %put %sysfunc(sysmsg());
67 %let syscc = %sysfunc(max(&syscc,%sysfunc(sysrc())));