I wondered if anyone could shed some light here:
I have some User Written Code in a DI Studio job which was working fine. The user written code is within a loop and I changed the ordering of some of the tranforms and incorporated more things into the loop and suddenly the User Written Code stopped working.
The original code was:
data _null_; length keepvar $2000; retain keepvar;
set &_INPUT end=e;
call symput('source'||left(put(_n_,2.)),OldColumn);
call symput('target'||left(put(_n_,2.)),NewColumn);
keepvar=catx(' ',keepvar,OldColumn);
if e then do;
call symput('keepvar',keepvar);
call symputx('numobs',&RowCount);
end;
run;
/* write the macro variables just set to the log - for checking during development*/
%put &keepvar;
%put &numobs;
When the code stopped working the %put &Keepvar was resulting in .
After much deliberation with my colleagues we decided to try changing the &_Input in the Data Step set statement to &_Input1 and this then worked. In the User Written Body code &_Input and &_Input1 appeared to be defined as the same thing as there is only one input data set so why did changing the code to &_Input1 work? Is it something to do with the ordering of the transforms and the loop?