BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dennis_oz
Quartz | Level 8

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
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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;

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20

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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 557 views
  • 1 like
  • 2 in conversation