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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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