BookmarkSubscribeRSS Feed
radhikaa4
Calcite | Level 5

Hello. Here's the sample dataset and I am trying to extract only first occurence of the group BY date

 

MASTER_IDvaluedate
11057/7/2003
11027/19/2003
2100.57/27/2001
21077/28/2001
21087/29/2001
3100.56/20/2002
3103.56/24/2002
4102.57/19/2001
41057/20/2001
4102.57/21/2001

 

Final output:

 

MASTER_IDvaluedate
11057/7/2003
2100.57/27/2001
3100.56/20/2002
4102.57/19/2001
2 REPLIES 2
art297
Opal | Level 21

just instruct your code to do it:

 

 

data want;
  set have;
  by master_id;
  if first.master_id;
run;

Art, CEO, AnalystFinder.com

kiranv_
Rhodochrosite | Level 12

something like should work

proc sql;
select * from have
group by master_id
having date =min(date);

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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