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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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