BookmarkSubscribeRSS Feed
NicolaD
Calcite | Level 5

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?

1 REPLY 1
LinusH
Tourmaline | Level 20

I haven't had any problems referring to _input. It's hard to help without seeing a SYMBOLGEN log.

Data never sleeps

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1067 views
  • 0 likes
  • 2 in conversation