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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1135 views
  • 0 likes
  • 3 in conversation