07-02-2017 02:23 PM - edited 07-02-2017 02:25 PM
This example code is takne from this paper (https://www.pharmasug.org/proceedings/2013/TF/PharmaSUG-2013-TF12.pdf). I don' think we need to retain ldosdt variable.
DATA ds1a (keep=usubjid fdosdt ldosdt); set ipadmin; by usubjid startdt; retain fdosdt ldosdt; if first.usubjid then fdosdt = startdt; if last.usubjid then do; ldosdt = startdt; output; end; run;
I tried to simulate the above with this program.
data test; input id $ x; cards; a 1 a 2 a 3 ; run; data want; set test; by id; retain f_; if first.id then f_=x; if last.id then do; l_=x; output; end; run;
Need further help from the community? Please ask a new question.