BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
desireatem
Pyrite | Level 9

Hello,

 I have this data that I want to sort by SID New_dt and NIPR.

For each subject I want just the minimum NPIR for that day. I also want to delete all observations with missing NPIR

For example this data should be reduced to Data A below:

Obs

SID

New_dt

NPiR

1

10155

.

.

2

101004

10/06/15

.

3

101004

10/14/15

4.2

4

101004

10/16/15

4.5

5

101004

10/19/15

4.1

6

101004

10/19/15

4.3

7

101004

10/19/15

4.6

8

101023

11/03/15

.

9

101023

11/05/15

4.2

10

101023

11/06/15

1.3

11

101023

11/07/15

3.8

12

101023

11/07/15

2.4

 

Should be reduced TO  Data A :

 

3

101004

10/14/15

4.2

4

101004

10/16/15

4.5

5

101004

10/19/15

4.1

9

101023

11/05/15

4.2

10

101023

11/06/15

1.3

12

101023

11/07/15

2.4

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

A one-step way:

 

proc summary data=have nway;

where npir > .;

class sid new_dt;

var npir;

output out=want (drop=_type_ _freq_) min=;

run;

 

If your actual data set contains additional variables, it becomes more problematic and we'd have to examine some of the details within the data.

View solution in original post

1 REPLY 1
Astounding
PROC Star

A one-step way:

 

proc summary data=have nway;

where npir > .;

class sid new_dt;

var npir;

output out=want (drop=_type_ _freq_) min=;

run;

 

If your actual data set contains additional variables, it becomes more problematic and we'd have to examine some of the details within the data.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 967 views
  • 1 like
  • 2 in conversation