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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 908 views
  • 0 likes
  • 3 in conversation