Hello,
I'm trying to concatenate values in a column for each distinct value of a field in a different column of the same table. I've looked at some code snippets, but nothing seems to work. I'm not sure if it's a variable scope or timing issue, but here is the code I am trying to run:
%macro group_concat(in_Group);
%global jobs='';
proc sql noprint;
select benchmark_job
into :jobs separated by ', '
from benchmark_lookup
where NAICS = &in_Group;
quit;
run;
%mend group_concat;
proc fcmp outlib=sasuser.funcs.concat trace print;
function ft_group_concat(in_Group$) $ 200;
rc = run_macro('group_concat',in_Group);
if rc = 0 then return(jobs);
else return('error');
endsub;
run;
data _null_ ;
in_Group = '111, 113, 115';
macro_jobs = ft_group_concat(in_Group);
put jobs=;
put macro_jobs;
run;
Thanks!