BookmarkSubscribeRSS Feed
Sean_Milligan
Calcite | Level 5
Good Morning,

Just wondering if someone can help me, i am trying to replicate a Retain Statement in DI studio, but i am struggling to find a method, i am simply wanting to create a new field which holds a value from a field already existing on the previous line,

for example:

retain ret_bal_cu ret_bal_pl ret_cls_dt amal mth_closed;
by pl_accnum pl_open_dt;

if first.pl_accnum and first.pl_open_dt then do;
ret_bal_cu=.;
ret_bal_pl=.;
ret_cls_dt=.;
end;

cu_prev_bal=ret_bal_cu;
pl_prev_bal=ret_bal_pl;
prev_cls_dt=ret_cls_dt;

ret_bal_cu=cu_curr_bal;
ret_bal_pl=pl_curr_bal;
ret_cls_dt=pl_cls_dt;


Can anyone provide any help?

cheers!
1 REPLY 1
Patrick
Opal | Level 21
Hi

I believe you would have to implement this with a "user written code" node.

... and if it comes to this then it's always worth asking if there is also another way to achieve the final result you need.

HTH
Patrick

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