hi all ,
please can you help get below desired output.
Thanks .
data have;
informat dates date9.;
format dates date9.;
input dates policy status :$8. group $20.;
datalines;
24APR2018 81341802 ACTIVE Gold
17DEC2018 81341802 ACTIVE Gold
14MAR2019 81341802 ACTIVE Gold
25MAR2019 81341802 CEASED Unknown
24JUL2019 81341802 CEASED Unknown
11SEP2019 81341802 CEASED Unknown
24SEP2019 81341802 CEASED Unknown
08JUL2016 81341828 ACTIVE Gold
09JUL2016 81341828 ACTIVE Gold
01APR2017 81341828 CEASED Unknown
01APR2018 81341828 CEASED Unknown
;
run;
want; 14MAR2019 81341802 Gold 09JUL2016 81341828 Gold
data have;
informat dates date9.;
format dates date9.;
input dates policy status :$8. group $20.;
datalines;
24APR2018 81341802 ACTIVE Gold
17DEC2018 81341802 ACTIVE Gold
14MAR2019 81341802 ACTIVE Gold
25MAR2019 81341802 CEASED Unknown
24JUL2019 81341802 CEASED Unknown
11SEP2019 81341802 CEASED Unknown
24SEP2019 81341802 CEASED Unknown
08JUL2016 81341828 ACTIVE Gold
09JUL2016 81341828 ACTIVE Gold
01APR2017 81341828 CEASED Unknown
01APR2018 81341828 CEASED Unknown
;
run;
data want;
set have;
by group notsorted;
if last.group and group='Gold';
run;
data have;
informat dates date9.;
format dates date9.;
input dates policy status :$8. group $20.;
datalines;
24APR2018 81341802 ACTIVE Gold
17DEC2018 81341802 ACTIVE Gold
14MAR2019 81341802 ACTIVE Gold
25MAR2019 81341802 CEASED Unknown
24JUL2019 81341802 CEASED Unknown
11SEP2019 81341802 CEASED Unknown
24SEP2019 81341802 CEASED Unknown
08JUL2016 81341828 ACTIVE Gold
09JUL2016 81341828 ACTIVE Gold
01APR2017 81341828 CEASED Unknown
01APR2018 81341828 CEASED Unknown
;
run;
data want;
set have;
by group notsorted;
if last.group and group='Gold';
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.