When you call a macro, it generates SAS code, presumably DATA step code in this case. The code it generates is placed at the point of the macro call.
Just looking at your code, it's impossible to know the problem, because you haven't shown us the macro definition. But that said, you've place the macro call after the OUTPUT statements in your code, which would be unusual. Usually an OUTPUT statement is at the bottom of a DATA step. So you might try:
DATA work.wf_mcd
work.wf_mcd_user
work.wf_mci (KEEP=id_key)
;
SET mcd.asign;
%dts_lookup(userid, dttm);
dts_tm = put(cats(userid, "_", put(datepart(dttm), yymmddn8.)), $mdm_rda_dts_team.);
if dts_tm in ("MCD")
THEN DO;
OUTPUT work.wf_mcd;
IF PUT(userid, $mcd_wq_list.) ^= "#"
THEN OUTPUT work.wf_mcd_user;
END;
*why is this line here twice? ;
dts_tm = put(cats(userid, "_", put(datepart(dttm), yymmddn8.)), $mdm_rda_dts_team.);
if dts_tm =: 'MCI'
THEN OUTPUT work.wf_mci;
RUN;
and see if you get lucky. But it would be better to look at the macro definition, think through what it is doing, and then decide where the macro invocation should go. Or maybe you can decide to remove the macro invocation and just paste the code you want. The macro language can be tricky to learn, and if you're still learning DATA step programming, it's probably better to wait on learning the macro language.
... View more