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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 776 views
  • 0 likes
  • 2 in conversation