Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Identify records with min

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 98
Accepted Solution

Identify records with min

Hi all,

I've got decent help here and am still looking for more.

This time I am trying to find records with minimum values. My sample data looks like below:

personiddays_gap
10
10
110
110
110
115
29
29
29
29
224
224
230
230
31
36
36
38
38
38
39
39
39

My target data is

personiddays_gap
10
10
29
29
29
29
31

That is, I want to find records with minimum value of days_gap for each personid. Does anyone know a way to do it?

Thanks a lot as always!

Lizi


Accepted Solutions
Solution
‎05-10-2015 07:43 PM
Trusted Advisor
Posts: 1,228

Re: Identify records with min

proc sql;

create table want as

select * from have

group by personid

having days_gap=min(days_gap);

quit;

View solution in original post


All Replies
Solution
‎05-10-2015 07:43 PM
Trusted Advisor
Posts: 1,228

Re: Identify records with min

proc sql;

create table want as

select * from have

group by personid

having days_gap=min(days_gap);

quit;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 318 views
  • 0 likes
  • 2 in conversation