BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello All,
I hope you can help me on this. In my dataset I have siblings and their addresses. I am trying to group all siblings by address, so I know all the siblings who reside at an address. Now in this group I only want to pick the youngest sibling and get that information. I am trying to do this in EG, I have the dataset sorted by mailing address, but I would like to know is there a way where I can get the youngest sibling in the group. (something like select top 1)
Here is my dataset

Address name age
111 street1 child1 5
111 street1 child2 10

In this group I only want to output info for
child1





Thanks for any help
Shri
2 REPLIES 2
RickM
Fluorite | Level 6
I think this would be much easier in a data step after you sort by address and age and then use first.address with by group processing to find the youngest.

Good luck!
art297
Opal | Level 21
Shri,

What do you want to do if the youngest are twins? If you don't confront any twins, or want multiple records in such a case, you could try something like:

proc sql noprint;
create table want as
select *
from have
group by Address
having age eq min(age)
;
quit;

HTH,
Art
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1644 views
  • 0 likes
  • 3 in conversation